diff options
author | Eduardo Julian | 2021-09-12 00:07:08 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-09-12 00:07:08 -0400 |
commit | dda05bca0956af5e5b3875c4cc36e61aa04772e4 (patch) | |
tree | 0f8b27697d58ab5c8e41aba7c7c9f769d3800767 /stdlib | |
parent | d48270f43c404ba19ca04da2553455ecaaf2caba (diff) |
Made the "#" character great again!
Diffstat (limited to 'stdlib')
498 files changed, 8838 insertions, 8941 deletions
diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index 0f6e94998..cf7137856 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -354,11 +354,11 @@ \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}}} + {#Item x {#Item y {#Item z {#End}}}} {#Some ($_ * x y z)} _ - #None)]) + {#None})]) (documentation: /.^ (format "Macro-expanding patterns." @@ -369,25 +369,25 @@ {#Some ($_ * x y z)} _ - #None)]) + {#None})]) (documentation: /.^or (format "Or-patterns." \n "It's a special macro meant to be used with 'case'.") [(type: Weekday (Variant - #Monday - #Tuesday - #Wednesday - #Thursday - #Friday - #Saturday - #Sunday)) + {#Monday} + {#Tuesday} + {#Wednesday} + {#Thursday} + {#Friday} + {#Saturday} + {#Sunday})) (def: (weekend? day) (-> Weekday Bit) (case day - (^or #Saturday #Sunday) + (^or {#Saturday} {#Sunday}) #1 _ @@ -488,11 +488,11 @@ \n "WARNING: Only use it within the type: macro.") [(type: Referrals (Variant - #All + {#All} {#Only (List Text)} {#Exclude (List Text)} - #Ignore - #Nothing))]) + {#Ignore} + {#Nothing}))]) (documentation: /.Record (format "Syntax for defining labelled/slotted product/tuple types." @@ -505,7 +505,7 @@ (documentation: /.type: "The type-definition macro." [(type: (List a) - #End + {#End} {#Item a (List a)})]) (documentation: /.Interface @@ -538,15 +538,15 @@ (All (_ a) (-> (Enum a) a a (List a))) (let [(^open "[0]") enum] (loop [end to - output #.End] + 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)}]) - ([#.Sum] [#.Product]) + ([.#Sum] [.#Product]) (^template [<tag>] [{<tag> left right} {<tag> (reduced env left) (reduced env right)}]) - ([#.Function] [#.Apply]) + ([.#Function] [.#Apply]) (^template [<tag>] [{<tag> old_env def} (case old_env - #.End + {.#End} {<tag> env def} _ type)]) - ([#.UnivQ] [#.ExQ]) + ([.#UnivQ] [.#ExQ]) - {#.Parameter idx} + {.#Parameter idx} (else type (list.item idx env)) _ @@ -715,7 +715,6 @@ [int +123 "+123"] [frac +123.0 "+123.0"] [text "123" "'123'"] - [tag ["yolo" "lol"] "#yolo.lol"] [identifier ["yolo" "lol"] "yolo.lol"] [form (list (bit #1)) "(#1)"] [tuple (list (bit #1)) "[#1]"] @@ -769,9 +768,9 @@ (documentation: /.name_of "Given an identifier or a tag, gives back a 2 tuple with the module and name parts, both as Text." - [(name_of #..doc) + [(name_of ..#doc) "=>" - ["documentation/lux" "doc"]]) + ["documentation/lux" "#doc"]]) (documentation: /.:parameter (format "WARNING: Please stay away from this macro; it's very likely to be removed in a future version of Lux." @@ -875,11 +874,11 @@ "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))]) + {.#None}))]) (documentation: /.false "The boolean FALSE value.") @@ -898,11 +897,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 1727f3c5f..a030eabaf 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 582c1fa4a..6af1e40d8 100644 --- a/stdlib/source/documentation/lux/control/maybe.lux +++ b/stdlib/source/documentation/lux/control/maybe.lux @@ -16,17 +16,17 @@ (documentation: /.else (format "Allows you to provide a default value that will be used" - \n "if a (Maybe x) value turns out to be #.None." + \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) + [(else +20 {.#None}) "=>" +20]) (documentation: /.trusted - (format "Assumes that a Maybe value is a #.Some and yields its value." + (format "Assumes that a Maybe value is a .#Some and yields its value." \n "Raises/throws a runtime error otherwise." \n "WARNING: Use with caution.") [(trusted trusted_computation)]) diff --git a/stdlib/source/documentation/lux/control/try.lux b/stdlib/source/documentation/lux/control/try.lux index 8176614d0..ed5b8dc5d 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 b8926391a..91f017509 100644 --- a/stdlib/source/documentation/lux/data/collection/array.lux +++ b/stdlib/source/documentation/lux/data/collection/array.lux @@ -86,8 +86,8 @@ (documentation: /.list (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 {.#None} array) + (list {.#Some default} array)]) (.def: .public documentation (.List $.Module) diff --git a/stdlib/source/documentation/lux/data/collection/list.lux b/stdlib/source/documentation/lux/data/collection/list.lux index 1c183591e..fa3ca1a09 100644 --- a/stdlib/source/documentation/lux/data/collection/list.lux +++ b/stdlib/source/documentation/lux/data/collection/list.lux @@ -53,7 +53,7 @@ [(repeated n x)]) (documentation: /.iterations - "Generates a list element by element until the function returns #.None." + "Generates a list element by element until the function returns .#None." [(iterations f x)]) (documentation: /.one @@ -124,7 +124,7 @@ (documentation: /.inits (format "For a list of size N, yields the first N-1 elements." - \n "Will yield a #.None for empty lists.") + \n "Will yield a .#None for empty lists.") [(inits xs)]) (documentation: /.together diff --git a/stdlib/source/documentation/lux/extension.lux b/stdlib/source/documentation/lux/extension.lux index 5d0e64f51..0172abaf7 100644 --- a/stdlib/source/documentation/lux/extension.lux +++ b/stdlib/source/documentation/lux/extension.lux @@ -39,7 +39,7 @@ "" [(generation: ("my generation" self phase archive [pass_through <synthesis>.any]) (for [@.jvm - (\ phase.monad each (|>> #jvm.Embedded + (\ phase.monad each (|>> {jvm.#Embedded} row.row) (phase archive pass_through))] (phase archive pass_through)))]) diff --git a/stdlib/source/documentation/lux/ffi.jvm.lux b/stdlib/source/documentation/lux/ffi.jvm.lux index d8e818783..c4f401f2e 100644 --- a/stdlib/source/documentation/lux/ffi.jvm.lux +++ b/stdlib/source/documentation/lux/ffi.jvm.lux @@ -142,13 +142,13 @@ (documentation: /.??? "Takes a (potentially null) ObjectType reference and creates a (Maybe ObjectType) for it." [(= (??? (: java/lang/String (null))) - #.None)] + {.#None})] [(= (??? "YOLO") - {#.Some "YOLO"})]) + {.#Some "YOLO"})]) (documentation: /.!!! (format "Takes a (Maybe ObjectType) and returns a ObjectType." - \n "A #.None would get translated into a (null).") + \n "A .#None would get translated into a (null).") [(= (null) (!!! (??? (: java/lang/Thread (null)))))] [(= "foo" @@ -158,8 +158,8 @@ (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} - #.None)]) + {.#Some value_as_string} + {.#None})]) (documentation: /.synchronized "Evaluates body, while holding a lock on a given object." @@ -184,7 +184,7 @@ (equals [java/lang/Object] boolean) (wait [int] "io" "try" void)])] ["Special options can also be given for the return values." - "'?' means that the values will be returned inside a Maybe type. That way, null becomes #.None." + "'?' means that the values will be returned inside a Maybe type. That way, null becomes .#None." "'try' means that the computation might throw an exception, and the return value will be wrapped by the Try type." "'io' means the computation has side effects, and will be wrapped by the IO type." "These options must show up in the following order ['io' 'try' '?'] (although, each option can be used independently)." diff --git a/stdlib/source/documentation/lux/ffi.old.lux b/stdlib/source/documentation/lux/ffi.old.lux index 64fbfcf45..f45b2df01 100644 --- a/stdlib/source/documentation/lux/ffi.old.lux +++ b/stdlib/source/documentation/lux/ffi.old.lux @@ -105,15 +105,15 @@ (documentation: /.??? "Takes a (potentially null) ObjectType reference and creates a (Maybe ObjectType) for it." [(= (??? (: java/lang/String (null))) - #.None)] + {.#None})] [(= (??? "YOLO") - {#.Some "YOLO"})]) + {.#Some "YOLO"})]) (documentation: /.!!! "Takes a (Maybe ObjectType) and returns a ObjectType." [(= "foo" (!!! (??? "foo")))] - ["A #.None would get translated into a (null)." + ["A .#None would get translated into a (null)." (= (null) (!!! (??? (: java/lang/Thread (null)))))]) @@ -121,8 +121,8 @@ (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} - #.None)]) + {.#Some value_as_string} + {.#None})]) (documentation: /.synchronized "Evaluates body, while holding a lock on a given object." @@ -147,7 +147,7 @@ (equals [java/lang/Object] boolean) (wait [int] "io" "try" void)])] ["Special options can also be given for the return values." - "'?' means that the values will be returned inside a Maybe type. That way, null becomes #.None." + "'?' means that the values will be returned inside a Maybe type. That way, null becomes .#None." "'try' means that the computation might throw an exception, and the return value will be wrapped by the Try type." "'io' means the computation has side effects, and will be wrapped by the IO type." "These options must show up in the following order ['io' 'try' '?'] (although, each option can be used independently)." diff --git a/stdlib/source/documentation/lux/type/unit.lux b/stdlib/source/documentation/lux/type/unit.lux index fdf8e27d6..667c9901f 100644 --- a/stdlib/source/documentation/lux/type/unit.lux +++ b/stdlib/source/documentation/lux/type/unit.lux @@ -44,8 +44,8 @@ (template [<type> <scale>] [(`` (documentation: <scale> - (let [numerator (value@ [#/.ratio #ratio.numerator] <scale>) - denominator (value@ [#/.ratio #ratio.denominator] <scale>)] + (let [numerator (value@ [/.#ratio ratio.#numerator] <scale>) + denominator (value@ [/.#ratio ratio.#denominator] <scale>)] (format "The '" (~~ (template.text [<scale>])) "' scale, from " (%.nat numerator) " to " (%.nat denominator) "."))))] [/.Kilo /.kilo] diff --git a/stdlib/source/documentation/lux/world/output/video/resolution.lux b/stdlib/source/documentation/lux/world/output/video/resolution.lux index e66d2a226..808bc1a42 100644 --- a/stdlib/source/documentation/lux/world/output/video/resolution.lux +++ b/stdlib/source/documentation/lux/world/output/video/resolution.lux @@ -23,8 +23,8 @@ (text.replaced "_" " ") text.upper_cased)] (format name " resolution: " - (%.nat (value@ #/.width <name>)) - "x" (%.nat (value@ #/.height <name>)) + (%.nat (value@ /.#width <name>)) + "x" (%.nat (value@ /.#height <name>)) ".")))] [/.svga] diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index aa4d89179..7339ac34d 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -37,8 +37,9 @@ #1) ... (type: .public (List a) -... #End -... {#Item a (List a)}) +... (Variant +... {#End} +... {#Item a (List a)})) ("lux def type tagged" List {9 #1 [..prelude_module "List"] @@ -53,14 +54,14 @@ {9 #0 {4 #0 1} {4 #0 0}}}}}} - {"End" "Item"} + {"#End" "#Item"} #1) ("lux def" Bit ("lux type check type" {9 #1 [..prelude_module "Bit"] - {0 #0 "#Bit" #End}}) + {0 #0 "#Bit" {#End}}}) #1) ("lux def" I64 @@ -69,42 +70,42 @@ [..prelude_module "I64"] {7 #0 {0 #0} - {0 #0 "#I64" {#Item {4 #0 1} #End}}}}) + {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}}}) + {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}}}) + {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}}}) + {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}}) + {0 #0 "#Frac" {#End}}}) #1) ("lux def" Text ("lux type check type" {9 #1 [..prelude_module "Text"] - {0 #0 "#Text" #End}}) + {0 #0 "#Text" {#End}}}) #1) ("lux def" Name @@ -115,19 +116,19 @@ #1) ... (type: .public (Maybe a) -... #None +... {#None} ... {#Some a}) ("lux def type tagged" Maybe {9 #1 [..prelude_module "Maybe"] {7 #0 - #End + {#End} {1 #0 ... None Any ... Some {4 #0 1}}}} - {"None" "Some"} + {"#None" "#Some"} #1) ... (type: .public Type @@ -150,9 +151,9 @@ ({Type_List ({Type_Pair {9 #0 - {0 #0 ["" #End]} + {0 #0 ["" {#End}]} {7 #0 - #End + {#End} {1 #0 ... Primitive {2 #0 Text Type_List} @@ -187,8 +188,8 @@ {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"} + ("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 @@ -199,7 +200,7 @@ ("lux def type tagged" Location {#Named [..prelude_module "Location"] {#Product Text {#Product Nat Nat}}} - ["module" "line" "column"] + ["#module" "#line" "#column"] #1) ... (type: .public (Ann m v) @@ -208,12 +209,12 @@ ... #datum v])) ("lux def type tagged" Ann {#Named [..prelude_module "Ann"] - {#UnivQ #End - {#UnivQ #End + {#UnivQ {#End} + {#UnivQ {#End} {#Product {#Parameter 3} {#Parameter 1}}}}} - ["meta" "datum"] + ["#meta" "#datum"] #1) ... (type: .public (Code' w) @@ -224,7 +225,6 @@ ... {#Frac Frac} ... {#Text Text} ... {#Identifier Name} -... {#Tag Name} ... {#Form (List (w (Code' w)))} ... {#Variant (List (w (Code' w)))} ... {#Tuple (List (w (Code' w)))}) @@ -232,7 +232,7 @@ {#Named [..prelude_module "Code'"] ({Code ({Code_List - {#UnivQ #End + {#UnivQ {#End} {#Sum ... Bit Bit @@ -255,23 +255,20 @@ ... Identifier Name {#Sum - ... Tag - Name + ... Form + Code_List {#Sum - ... Form + ... Variant + Code_List + ... Tuple 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"} + {"#Bit" "#Nat" "#Int" "#Rev" "#Frac" "#Text" "#Identifier" "#Form" "#Variant" "#Tuple"} #1) ... (type: .public Code @@ -348,16 +345,6 @@ ([_ name] (_ann {#Identifier ["" name]}))) #0) -("lux def" tag$ - ("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]}))) - #0) - ("lux def" form$ ("lux type check" {#Function {#Apply Code List} Code} ([_ tokens] (_ann {#Form tokens}))) @@ -413,7 +400,7 @@ {#Sum Label {#Sum Label Alias}}}}} - {"Definition" "Type" "Label" "Slot" "Alias"} + {"#Definition" "#Type" "#Label" "#Slot" "#Alias"} .public) ... (type: .public (Bindings k v) @@ -422,8 +409,8 @@ ... #mappings (List [k v])])) ("lux def type tagged" Bindings {#Named [..prelude_module "Bindings"] - {#UnivQ #End - {#UnivQ #End + {#UnivQ {#End} + {#UnivQ {#End} {#Product ... counter Nat @@ -431,7 +418,7 @@ {#Apply {#Product {#Parameter 3} {#Parameter 1}} List}}}}} - ["counter" "mappings"] + ["#counter" "#mappings"] .public) ... (type: .public Ref @@ -443,7 +430,7 @@ Nat ... Captured Nat}} - {"Local" "Captured"} + {"#Local" "#Captured"} .public) ... (type: .public Scope @@ -462,7 +449,7 @@ {#Apply {#Product Type Nat} {#Apply Text Bindings}} ... captured {#Apply {#Product Type Ref} {#Apply Text Bindings}}}}}} - ["name" "inner" "locals" "captured"] + ["#name" "#inner" "#locals" "#captured"] .public) ("lux def" Code_List @@ -475,14 +462,14 @@ ... {#Right r}) ("lux def type tagged" Either {#Named [..prelude_module "Either"] - {#UnivQ #End - {#UnivQ #End + {#UnivQ {#End} + {#UnivQ {#End} {#Sum ... Left {#Parameter 3} ... Right {#Parameter 1}}}}} - {"Left" "Right"} + {"#Left" "#Right"} .public) ... (type: .public Source @@ -507,7 +494,7 @@ Any ... #Cached Any}}} - {"Active" "Compiled" "Cached"} + {"#Active" "#Compiled" "#Cached"} .public) ... (type: .public Module @@ -534,7 +521,7 @@ ... module_state Module_State }}}}} - ["module_hash" "module_aliases" "definitions" "imports" "module_state"] + ["#module_hash" "#module_aliases" "#definitions" "#imports" "#module_state"] .public) ... (type: .public Type_Context @@ -551,7 +538,7 @@ ... var_bindings {#Apply {#Product Nat {#Apply Type Maybe}} List}}}} - ["ex_counter" "var_counter" "var_bindings"] + ["#ex_counter" "#var_counter" "#var_bindings"] .public) ... (type: .public Mode @@ -566,7 +553,7 @@ Any ... Interpreter Any}}} - {"Build" "Eval" "Interpreter"} + {"#Build" "#Eval" "#Interpreter"} .public) ... (type: .public Info @@ -584,7 +571,7 @@ Text ... mode Mode}}} - ["target" "version" "mode"] + ["#target" "#version" "#mode"] .public) ... (type: .public Lux @@ -605,8 +592,8 @@ ("lux def type tagged" Lux {#Named [..prelude_module "Lux"] ({Lux - {#Apply {0 #0 ["" #End]} - {#UnivQ #End + {#Apply {0 #0 ["" {#End}]} + {#UnivQ {#End} {#Product ... info Info @@ -648,8 +635,8 @@ {#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"] + {#Apply {0 #0 ["" {#End}]} {#Parameter 0}})} + ["#info" "#source" "#location" "#current_module" "#modules" "#scopes" "#type_context" "#expected" "#seed" "#scope_type_vars" "#extensions" "#eval" "#host"] .public) ... (type: .public (Meta a) @@ -657,7 +644,7 @@ ("lux def" Meta ("lux type check type" {#Named [..prelude_module "Meta"] - {#UnivQ #End + {#UnivQ {#End} {#Function Lux {#Apply {#Product Lux {#Parameter 1}} {#Apply Text Either}}}}}) @@ -676,13 +663,13 @@ ("lux def" Macro ("lux type check type" {#Named [..prelude_module "Macro"] - {#Primitive "#Macro" #End}}) + {#Primitive "#Macro" {#End}}}) .public) ... Base functions & macros ("lux def" in_meta ("lux type check" - {#UnivQ #End + {#UnivQ {#End} {#Function {#Parameter 1} {#Function Lux {#Apply {#Product Lux @@ -695,7 +682,7 @@ ("lux def" failure ("lux type check" - {#UnivQ #End + {#UnivQ {#End} {#Function Text {#Function Lux {#Apply {#Product Lux @@ -709,10 +696,10 @@ ("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''")} @@ -722,71 +709,49 @@ ("lux def" function'' ("lux macro" ([_ tokens] - ({{#Item [_ {#Tuple {#Item arg args'}}] {#Item body #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 + {#Item arg {#End}}}}) + {#Item ({{#End} body _ (_ann {#Form {#Item (_ann {#Identifier [..prelude_module "function''"]}) {#Item (_ann {#Tuple args'}) - {#Item body #End}}}})} + {#Item body {#End}}}}})} args') - #End}}}) - #End}) + {#End}}}}) + {#End}}) - {#Item [_ {#Identifier ["" self]}] {#Item [_ {#Tuple {#Item arg args'}}] {#Item body #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 + {#Item arg {#End}}}}) + {#Item ({{#End} body _ (_ann {#Form {#Item (_ann {#Identifier [..prelude_module "function''"]}) {#Item (_ann {#Tuple args'}) - {#Item body #End}}}})} + {#Item body {#End}}}}})} args') - #End}}}) - #End}) + {#End}}}}) + {#End}}) _ (failure "Wrong syntax for function''")} tokens))) #0) -("lux def" location_code - ("lux type check" Code - (tuple$ {#Item (text$ "") {#Item (nat$ 0) {#Item (nat$ 0) #End}}})) - #0) - -("lux def" meta_code - ("lux type check" {#Function Name {#Function Code Code}} - ([_ tag] - ([_ value] - (tuple$ {#Item location_code - {#Item (form$ {#Item (tag$ tag) {#Item value #End}}) - #End}})))) - #0) - -("lux def" flag_meta - ("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]}]}))) - #0) - ("lux def" as_def ("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}} (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 @@ -795,7 +760,7 @@ (form$ {#Item (identifier$ [..prelude_module "function''"]) {#Item self {#Item (tuple$ inputs) - {#Item output #End}}}}))) + {#Item output {#End}}}}}))) #0) ("lux def" as_macro @@ -803,7 +768,7 @@ (function'' [expression] (form$ {#Item (text$ "lux macro") {#Item expression - #End}}))) + {#End}}}))) #0) ("lux def" def:'' @@ -811,16 +776,16 @@ (function'' [tokens] ({{#Item [export_policy {#Item [[_ {#Form {#Item [name args]}}] - {#Item [type {#Item [body #End]}]}]}]} + {#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]}]}]}]} + {#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''")} @@ -830,10 +795,10 @@ ("lux def" macro:' ("lux macro" (function'' [tokens] - ({{#Item export_policy {#Item [_ {#Form {#Item name args}}] {#Item body #End}}} + ({{#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:'")} @@ -841,31 +806,31 @@ #0) (macro:' .public (comment tokens) - (in_meta #End)) + (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 (variant$ {#Item (tag$ [..prelude_module "Apply"]) - {#Item y {#Item x #End}}}) + {#Item (variant$ {#Item (identifier$ [..prelude_module "#Apply"]) + {#Item y {#Item x {#End}}}}) xs}}) - #End}) + {#End}}) _ (failure "Wrong syntax for $'")} tokens)) (def:'' .private (list\each f xs) - {#UnivQ #End - {#UnivQ #End + {#UnivQ {#End} + {#UnivQ {#End} {#Function {#Function {#Parameter 3} {#Parameter 1}} {#Function ($' List {#Parameter 3}) ($' List {#Parameter 1})}}}} - ({#End - #End + ({{#End} + {#End} {#Item x xs'} {#Item (f x) (list\each f xs')}} @@ -881,7 +846,7 @@ {#Item [x y] (replacement_environment xs' ys')} _ - #End} + {#End}} [xs ys])) (def:'' .private (text\= reference sample) @@ -890,8 +855,8 @@ (def:'' .private (replacement for environment) {#Function Text {#Function Replacement_Environment ($' Maybe Code)}} - ({#End - #None + ({{#End} + {#None} {#Item [k v] environment'} ({#1 @@ -908,7 +873,7 @@ ({{#Some replacement} replacement - #None + {#None} syntax} (..replacement name reps)) @@ -934,13 +899,13 @@ (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}}}}}} - ({#End + {#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'} @@ -948,22 +913,33 @@ xs)) (def:'' .private (list\size list) - {#UnivQ #End + {#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}})) + (form$ {#Item (variant$ {#Item binding {#Item body {#End}}}) + {#Item value {#End}}})) + +(def:'' .private |#End| + Code + (variant$ {#Item (identifier$ [..prelude_module "#End"]) {#End}})) + +(def:'' .private (|#Item| head tail) + {#Function Code {#Function Code Code}} + (variant$ {#Item (identifier$ [..prelude_module "#Item"]) + {#Item head + {#Item tail + {#End}}}})) (def:'' .private (UnivQ$ body) {#Function Code Code} - (variant$ {#Item (tag$ [..prelude_module "UnivQ"]) {#Item (tag$ [..prelude_module "End"]) {#Item body #End}}})) + (variant$ {#Item (identifier$ [..prelude_module "#UnivQ"]) {#Item ..|#End| {#Item body {#End}}}})) (def:'' .private (ExQ$ body) {#Function Code Code} - (variant$ {#Item (tag$ [..prelude_module "ExQ"]) {#Item (tag$ [..prelude_module "End"]) {#Item body #End}}})) + (variant$ {#Item (identifier$ [..prelude_module "#ExQ"]) {#Item ..|#End| {#Item body {#End}}}})) (def:'' .private quantification_level Text @@ -977,12 +953,12 @@ (def:'' .private (quantified_type_parameter idx) {#Function Nat Code} - (variant$ {#Item (tag$ [..prelude_module "Parameter"]) + (variant$ {#Item (identifier$ [..prelude_module "#Parameter"]) {#Item (form$ {#Item (text$ "lux i64 +") {#Item (local_identifier$ ..quantification_level) {#Item (nat$ idx) - #End}}}) - #End}})) + {#End}}}}) + {#End}}})) (def:'' .private (next_level depth) {#Function Nat Nat} @@ -1052,7 +1028,7 @@ {#Item (local_identifier$ ..quantification_level) {#Item (nat$ 0) {#Item body - #End}}}})) + {#End}}}}})) (def:'' .private (with_quantification depth body) {#Function Nat {#Function Code Code}} @@ -1064,7 +1040,7 @@ ("lux i64 *" +2 ("lux type as" Int depth)))) - #End}}}) + {#End}}}}) body)} (local_identifier$ ..quantification_level))) @@ -1081,8 +1057,7 @@ #mappings locals]] (list\mix (function'' [local verdict] ({[local _] - ({#1 #1 - _ ("lux text =" ..quantification_level local)} + ({#1 #1 _ ("lux text =" ..quantification_level local)} verdict)} local)) #0 @@ -1095,13 +1070,13 @@ (macro:' .public (All tokens lux) ({{#Item [_ {#Form {#Item self_name args}}] - {#Item body #End}} + {#Item body {#End}}} {#Right [lux {#Item ({raw ({#1 raw #0 (..quantified raw)} (initialized_quantification? lux))} - ({#End + ({{#End} body {#Item head tail} @@ -1119,7 +1094,7 @@ body)] args))))} args)) - #End}]} + {#End}}]} _ {#Left "Wrong syntax for All"}} @@ -1127,13 +1102,13 @@ (macro:' .public (Ex tokens lux) ({{#Item [_ {#Form {#Item self_name args}}] - {#Item body #End}} + {#Item body {#End}}} {#Right [lux {#Item ({raw ({#1 raw #0 (..quantified raw)} (initialized_quantification? lux))} - ({#End + ({{#End} body {#Item head tail} @@ -1151,7 +1126,7 @@ body)] args))))} args)) - #End}]} + {#End}}]} _ {#Left "Wrong syntax for Ex"}} @@ -1163,58 +1138,49 @@ (list\mix ("lux type check" (All (_ a) {#Function a {#Function ($' List a) ($' List a)}}) (function'' [head tail] {#Item head tail})) - #End + {#End} list)) (macro:' .public (-> tokens) ({{#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}}}))) + (function'' [i o] (variant$ {#Item (identifier$ [..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] - (variant$ {#Item (tag$ [..prelude_module "Item"]) - {#Item (tuple$ {#Item [head {#Item [tail #End]}]}) - #End}})) - (tag$ [..prelude_module "End"]) - (list\reversed xs)) - #End})) + (in_meta {#Item (list\mix |#Item| |#End| (list\reversed xs)) + {#End}})) (macro:' .public (list& xs) ({{#Item last init} - (in_meta (list (list\mix (function'' [head tail] - (variant$ (list (tag$ [..prelude_module "Item"]) - (tuple$ (list head tail))))) - last - init))) + (in_meta (list (list\mix |#Item| last init))) _ (failure "Wrong syntax for list&")} (list\reversed xs))) (macro:' .public (Union tokens) - ({#End + ({{#End} (in_meta (list (identifier$ [..prelude_module "Nothing"]))) {#Item last prevs} - (in_meta (list (list\mix (function'' [left right] (variant$ (list (tag$ [..prelude_module "Sum"]) left right))) + (in_meta (list (list\mix (function'' [left right] (variant$ (list (identifier$ [..prelude_module "#Sum"]) left right))) last prevs)))} (list\reversed tokens))) (macro:' .public (Tuple tokens) - ({#End + ({{#End} (in_meta (list (identifier$ [..prelude_module "Any"]))) {#Item last prevs} - (in_meta (list (list\mix (function'' [left right] (variant$ (list (tag$ [..prelude_module "Product"]) left right))) + (in_meta (list (list\mix (function'' [left right] (variant$ (list (identifier$ [..prelude_module "#Product"]) left right))) last prevs)))} (list\reversed tokens))) @@ -1226,8 +1192,8 @@ _ ["" tokens]} tokens) - ({{#Item [[_ {#Tuple args}] {#Item [body #End]}]} - ({#End + ({{#Item [[_ {#Tuple args}] {#Item [body {#End}]}]} + ({{#End} (failure "function' requires a non-empty arguments tuple.") {#Item [harg targs]} @@ -1248,7 +1214,7 @@ (macro:' .private (def:''' tokens) ({{#Item [export_policy {#Item [[_ {#Form {#Item [name args]}}] - {#Item [type {#Item [body #End]}]}]}]} + {#Item [type {#Item [body {#End}]}]}]}]} (in_meta (list (form$ (list (text$ "lux def") name (form$ (list (text$ "lux type check") @@ -1259,7 +1225,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") @@ -1285,11 +1251,11 @@ {#Item [x y] (pairs xs')} _ - #End} + {#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] @@ -1306,7 +1272,7 @@ (def:''' .private (any? p xs) (All (_ a) (-> (-> a Bit) ($' List a) Bit)) - ({#End + ({{#End} #0 {#Item x xs'} @@ -1322,13 +1288,11 @@ (def:''' .private (untemplated_list tokens) (-> ($' List Code) Code) - ({#End - (_ann {#Tag [..prelude_module "End"]}) + ({{#End} + |#End| - {#Item [token tokens']} - (_ann {#Variant (list (_ann {#Tag [..prelude_module "Item"]}) - token - (untemplated_list tokens'))})} + {#Item token tokens'} + (|#Item| token (untemplated_list tokens'))} tokens)) (def:''' .private (list\composite xs ys) @@ -1336,7 +1300,7 @@ ({{#Item x xs'} {#Item x (list\composite xs' ys)} - #End + {#End} ys} xs)) @@ -1384,9 +1348,9 @@ ... (type: (Monad m) ... (Interface ... (: (All (_ a) (-> a (m a))) -... in) +... #in) ... (: (All (_ a b) (-> (-> a (m b)) (m a) (m b))) -... then))) +... #then))) ("lux def type tagged" Monad {#Named [..prelude_module "Monad"] (All (_ !) @@ -1396,7 +1360,7 @@ (-> (-> a ($' ! b)) ($' ! a) ($' ! b)))))} - ["in" "then"] + ["#in" "#then"] #0) (def:''' .private maybe_monad @@ -1406,8 +1370,8 @@ #then (function' [f ma] - ({#None #None - {#Some a} (f a)} + ({{#None} {#None} + {#Some a} (f a)} ma))]) (def:''' .private meta_monad @@ -1428,7 +1392,7 @@ (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) @@ -1452,8 +1416,8 @@ var)))) body (list\reversed (pairs bindings)))] - (in_meta (list (form$ (list (variant$ (list (tuple$ (list (tag$ [..prelude_module "in"]) g!in - (tag$ [..prelude_module "then"]) g!then)) + (in_meta (list (form$ (list (variant$ (list (tuple$ (list (identifier$ [..prelude_module "#in"]) g!in + (identifier$ [..prelude_module "#then"]) g!then)) body')) monad))))) @@ -1468,8 +1432,8 @@ ($' List a) ($' m ($' List b)))) (let' [[#in in #then _] m] - ({#End - (in #End) + ({{#End} + (in {#End}) {#Item x xs'} (do m @@ -1486,7 +1450,7 @@ ($' List a) ($' m b))) (let' [[#in in #then _] m] - ({#End + ({{#End} (in y) {#Item x xs'} @@ -1496,7 +1460,7 @@ 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)))) @@ -1517,8 +1481,8 @@ {#Some v} (plist\value k plist')) - #End - #None} + {#End} + {#None}} plist)) (def:''' .private (text\composite x y) @@ -1541,33 +1505,26 @@ #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]} - - {#Definition [exported? def_type def_value]} - {#Right [state full_name]} + ({{#Definition _} {#Right [state full_name]} + {#Label _} {#Right [state full_name]} + {#Slot _} {#Right [state full_name]} + {#Type _} {#Right [state full_name]} - {#Type [exported? type labels]} - {#Right [state full_name]} - - {#Label _} - {#Left ($_ text\composite "Unknown definition: " (name\encoded full_name))} - - {#Slot _} - {#Left ($_ text\composite "Unknown definition: " (name\encoded full_name))}} + {#Alias real_name} + {#Right [state real_name]}} constant) - #None + {#None} {#Left ($_ text\composite "Unknown definition: " (name\encoded full_name))}} (plist\value name definitions)) - #None + {#None} {#Left ($_ text\composite "Unknown module: " module " @ " (name\encoded full_name))}} (plist\value module modules)))) -(def:''' .private (code_list expression) +(def:''' .private (:List<Code> expression) (-> Code Code) - (let' [type (variant$ (list (tag$ [..prelude_module "Apply"]) + (let' [type (variant$ (list (identifier$ [..prelude_module "#Apply"]) (identifier$ [..prelude_module "Code"]) (identifier$ [..prelude_module "List"])))] (form$ (list (text$ "lux type check") type expression)))) @@ -1575,32 +1532,31 @@ (def:''' .private (spliced replace? untemplated elems) (-> Bit (-> Code ($' Meta Code)) ($' List Code) ($' Meta Code)) ({#1 - ({#End - (in_meta (tag$ [..prelude_module "End"])) + ({{#End} + (in_meta |#End|) {#Item lastI inits} (do meta_monad - [lastO ({[_ {#Form {#Item [[_ {#Identifier ["" "~+"]}] {#Item [spliced #End]}]}}] - (in (code_list spliced)) + [lastO ({[_ {#Form {#Item [[_ {#Identifier ["" "~+"]}] {#Item [spliced {#End}]}]}}] + (in (:List<Code> spliced)) _ (do meta_monad [lastO (untemplated lastI)] - (in (code_list (variant$ (list (tag$ [..prelude_module "Item"]) - (tuple$ (list lastO (tag$ [..prelude_module "End"]))))))))} + (in (:List<Code> (|#Item| lastO |#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"])))] - (in (form$ (list g!in-module (code_list spliced) rightO)))) + (in (form$ (list g!in-module (:List<Code> spliced) rightO)))) _ (do meta_monad [leftO (untemplated leftI)] - (in (variant$ (list (tag$ [..prelude_module "Item"]) (tuple$ (list leftO rightO))))))} + (in (|#Item| leftO rightO)))} leftI)) lastO inits))} @@ -1613,40 +1569,28 @@ (def:''' .private (untemplated_text value) (-> Text Code) - (with_location (variant$ (list (tag$ [..prelude_module "Text"]) (text$ value))))) + (with_location (variant$ (list (identifier$ [..prelude_module "#Text"]) (text$ value))))) (def:''' .private (untemplated replace? subst token) (-> Bit Text Code ($' Meta Code)) ({[_ [_ {#Bit value}]] - (in_meta (with_location (variant$ (list (tag$ [..prelude_module "Bit"]) (bit$ value))))) + (in_meta (with_location (variant$ (list (identifier$ [..prelude_module "#Bit"]) (bit$ value))))) [_ [_ {#Nat value}]] - (in_meta (with_location (variant$ (list (tag$ [..prelude_module "Nat"]) (nat$ value))))) + (in_meta (with_location (variant$ (list (identifier$ [..prelude_module "#Nat"]) (nat$ value))))) [_ [_ {#Int value}]] - (in_meta (with_location (variant$ (list (tag$ [..prelude_module "Int"]) (int$ value))))) + (in_meta (with_location (variant$ (list (identifier$ [..prelude_module "#Int"]) (int$ value))))) [_ [_ {#Rev value}]] - (in_meta (with_location (variant$ (list (tag$ [..prelude_module "Rev"]) (rev$ value))))) + (in_meta (with_location (variant$ (list (identifier$ [..prelude_module "#Rev"]) (rev$ value))))) [_ [_ {#Frac value}]] - (in_meta (with_location (variant$ (list (tag$ [..prelude_module "Frac"]) (frac$ value))))) + (in_meta (with_location (variant$ (list (identifier$ [..prelude_module "#Frac"]) (frac$ value))))) [_ [_ {#Text value}]] (in_meta (untemplated_text value)) - [#0 [_ {#Tag [module name]}]] - (in_meta (with_location (variant$ (list (tag$ [..prelude_module "Tag"]) (tuple$ (list (text$ module) (text$ name))))))) - - [#1 [_ {#Tag [module name]}]] - (let' [module' ({"" - subst - - _ - module} - module)] - (in_meta (with_location (variant$ (list (tag$ [..prelude_module "Tag"]) (tuple$ (list (text$ module') (text$ name)))))))) - [#1 [_ {#Identifier [module name]}]] (do meta_monad [real_name ({"" @@ -1658,52 +1602,52 @@ (in [module name])} module) .let' [[module name] real_name]] - (in_meta (with_location (variant$ (list (tag$ [..prelude_module "Identifier"]) (tuple$ (list (text$ module) (text$ name)))))))) + (in_meta (with_location (variant$ (list (identifier$ [..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))))))) + (in_meta (with_location (variant$ (list (identifier$ [..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 (variant$ (list (tag$ [..prelude_module "Form"]) + (in (with_location (variant$ (list (identifier$ [..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}]] (do meta_monad [output (spliced replace? (untemplated replace? subst) elems) - .let' [[_ output'] (with_location (variant$ (list (tag$ [..prelude_module "Form"]) output)))]] + .let' [[_ output'] (with_location (variant$ (list (identifier$ [..prelude_module "#Form"]) output)))]] (in [meta output'])) [_ [meta {#Variant elems}]] (do meta_monad [output (spliced replace? (untemplated replace? subst) elems) - .let' [[_ output'] (with_location (variant$ (list (tag$ [..prelude_module "Variant"]) output)))]] + .let' [[_ output'] (with_location (variant$ (list (identifier$ [..prelude_module "#Variant"]) output)))]] (in [meta output'])) [_ [meta {#Tuple elems}]] (do meta_monad [output (spliced replace? (untemplated replace? subst) elems) - .let' [[_ output'] (with_location (variant$ (list (tag$ [..prelude_module "Tuple"]) output)))]] + .let' [[_ output'] (with_location (variant$ (list (identifier$ [..prelude_module "#Tuple"]) output)))]] (in [meta output']))} [replace? token])) (macro:' .public (primitive tokens) - ({{#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}] {#End}} + (in_meta (list (variant$ (list (identifier$ [..prelude_module "#Primitive"]) (text$ class_name) |#End|)))) - {#Item [_ {#Text class_name}] {#Item [_ {#Tuple params}] #End}} - (in_meta (list (variant$ (list (tag$ [..prelude_module "Primitive"]) (text$ class_name) (untemplated_list params))))) + {#Item [_ {#Text class_name}] {#Item [_ {#Tuple params}] {#End}}} + (in_meta (list (variant$ (list (identifier$ [..prelude_module "#Primitive"]) (text$ class_name) (untemplated_list params))))) _ (failure "Wrong syntax for primitive")} @@ -1724,7 +1668,7 @@ state)) (macro:' .public (` tokens) - ({{#Item template #End} + ({{#Item template {#End}} (do meta_monad [current_module current_module_name =template (untemplated #1 current_module template)] @@ -1737,7 +1681,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))))) @@ -1747,7 +1691,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))))) @@ -1769,9 +1713,6 @@ [_ {#Form parts}] (form$ (list\composite parts (list acc))) - [_ {#Tag _}] - (` {(~ app) (~ acc)}) - _ (` ((~ app) (~ acc)))} app))) @@ -1795,9 +1736,6 @@ [_ {#Form parts}] (form$ (list\composite parts (list acc))) - [_ {#Tag name}] - (` {(~ app) (~ acc)}) - _ (` ((~ app) (~ acc)))} app))) @@ -1819,16 +1757,7 @@ {#Some sname} _ - #None} - x)) - -(def:''' .private (tag_name x) - (-> Code ($' Maybe Name)) - ({[_ {#Tag sname}] - {#Some sname} - - _ - #None} + {#None}} x)) (def:''' .private (identifier_short x) @@ -1837,7 +1766,7 @@ {#Some sname} _ - #None} + {#None}} x)) (def:''' .private (tuple_list tuple) @@ -1846,7 +1775,7 @@ {#Some members} _ - #None} + {#None}} tuple)) (def:''' .private (realized_template env template) @@ -1904,7 +1833,7 @@ (def:''' .private (list\conjoint xs) (All (_ a) (-> ($' List ($' List a)) ($' List a))) - (list\mix list\composite #End (list\reversed xs))) + (list\mix list\composite {#End} (list\reversed xs))) (macro:' .public (template tokens) ({{#Item [[_ {#Tuple bindings}] {#Item [[_ {#Tuple templates}] data]}]} @@ -2026,7 +1955,7 @@ (def:''' .private (macro_type? type) (-> Type Bit) - ({{#Named ["library/lux" "Macro"] {#Primitive "#Macro" #End}} + ({{#Named ["library/lux" "Macro"] {#Primitive "#Macro" {#End}}} #1 _ @@ -2050,17 +1979,17 @@ {#Some ("lux type as" Macro def_value)} (if (text\= module current_module) {#Some ("lux type as" Macro def_value)} - #None)) - #None) + {#None})) + {#None}) {#Type [exported? type labels]} - #None + {#None} {#Label _} - #None + {#None} {#Slot _} - #None} + {#None}} ("lux type check" Global gdef)))) (def:''' .private (normal name) @@ -2094,16 +2023,16 @@ [name (normal name) output (macro' name)] (in ({{#Some _} #1 - #None #0} + {#None} #0} output)))) (def:''' .private (list\interposed sep xs) (All (_ a) (-> a ($' List a) ($' List a))) - ({#End + ({{#End} xs - {#Item [x #End]} + {#Item [x {#End}]} xs {#Item [x xs']} @@ -2119,7 +2048,7 @@ ({{#Some macro} (("lux type as" Macro' macro) args) - #None + {#None} (in (list token))} ?macro)) @@ -2139,7 +2068,7 @@ recursive_expansion (monad\each meta_monad expansion top_level_expansion)] (in (list\conjoint recursive_expansion))) - #None + {#None} (in (list token))} ?macro)) @@ -2159,7 +2088,7 @@ expansion' (monad\each meta_monad full_expansion expansion)] (in (list\conjoint expansion'))) - #None + {#None} (do meta_monad [args' (monad\each meta_monad full_expansion args)] (in (list (form$ {#Item (identifier$ name) (list\conjoint args')}))))} @@ -2213,11 +2142,6 @@ name ($_ text\composite module "." name)) - [_ {#Tag [module name]}] - (if (text\= "" module) - ($_ text\composite "#" name) - ($_ text\composite "#" module "." name)) - [_ {#Form xs}] ($_ text\composite "(" (|> xs (list\each code\encoded) @@ -2242,11 +2166,8 @@ (def:''' .private (normal_type type) (-> Code Code) - ({[_ {#Variant {#Item [_ {#Tag tag}] parts}}] - (` {(~ (tag$ tag)) (~+ (list\each normal_type parts))}) - - [_ {#Variant members}] - (` (Or (~+ (list\each normal_type members)))) + ({[_ {#Variant {#Item [_ {#Identifier identifier}] parts}}] + (` {(~ (identifier$ identifier)) (~+ (list\each normal_type parts))}) [_ {#Tuple members}] (` (Tuple (~+ (list\each normal_type members)))) @@ -2254,33 +2175,33 @@ [_ {#Form {#Item [_ {#Text "lux in-module"}] {#Item [_ {#Text module}] {#Item type' - #End}}}}] + {#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}}}] + [_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}}}] + {#End}}}}] + [_0 {#Form {#Item [_1 {#Variant {#Item binding {#Item (normal_type body) {#End}}}}] {#Item value - #End}}}] + {#End}}}}] [_0 {#Form {#Item [_1 {#Identifier ["library/lux" "__adjusted_quantified_type__"]}] {#Item _permission {#Item _level {#Item body - #End}}}}}] + {#End}}}}}}] [_0 {#Form {#Item [_1 {#Identifier [..prelude_module "__adjusted_quantified_type__"]}] {#Item _permission {#Item _level {#Item (normal_type body) - #End}}}}}] + {#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)) @@ -2289,13 +2210,13 @@ type)) (macro:' .public (type tokens) - ({{#Item type #End} + ({{#Item type {#End}} (do meta_monad [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'))) _ @@ -2308,7 +2229,7 @@ tokens)) (macro:' .public (: tokens) - ({{#Item type {#Item value #End}} + ({{#Item type {#Item value {#End}}} (in_meta (list (` ("lux type check" (..type (~ type)) (~ value))))) @@ -2318,7 +2239,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))))) @@ -2330,8 +2251,8 @@ (def:''' .private (empty? xs) (All (_ a) (-> ($' List a) Bit)) - ({#End #1 - _ #0} + ({{#End} #1 + _ #0} xs)) (template [<name> <type> <value>] @@ -2374,23 +2295,23 @@ (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}}}} + ({{#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} + {#None}} tokens))] ({{#Some [export_policy name args ?type body]} - (let' [body' ({#End + (let' [body' ({{#End} body _ @@ -2399,14 +2320,14 @@ body'' ({{#Some type} (` (: (~ type) (~ body'))) - #None + {#None} body'} ?type)] (in_meta (list (` ("lux def" (~ name) (~ body'') (~ export_policy)))))) - #None + {#None} (failure "Wrong syntax for def'")} parts))) @@ -2432,7 +2353,7 @@ [sub_expansion (expander branches')] (in (list& pattern body sub_expansion))) - #End + {#End} (do meta_monad [] (in (list))) _ @@ -2455,11 +2376,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)) _ @@ -2472,7 +2393,7 @@ (case tokens (^ (list& [_ {#Form patterns}] body branches)) (case patterns - #End + {#End} (failure "^or cannot have 0 patterns") _ @@ -2518,7 +2439,7 @@ {#Some name head tail body} _ - #None)) + {#None})) {#Some g!name head tail body} (let [g!blank (local_identifier$ "") nest (: (-> Code (-> Code Code Code)) @@ -2531,7 +2452,7 @@ (in_meta (list (nest (..local_identifier$ g!name) head (list\mix (nest g!blank) body (list\reversed tail)))))) - #None + {#None} (failure "Wrong syntax for function"))) (def:' .private (endP tokens) @@ -2541,7 +2462,7 @@ {#Some []} _ - #None)) + {#None})) (def:' .private (anyP tokens) (-> (List Code) (Maybe [(List Code) Code])) @@ -2550,7 +2471,7 @@ {#Some [tokens' code]} _ - #None)) + {#None})) (def:' .private (local_identifierP tokens) (-> (List Code) (Maybe [(List Code) Text])) @@ -2559,14 +2480,14 @@ {#Some [tokens' local_identifier]} _ - #None)) + {#None})) (template [<parser> <item_type> <item_parser>] [(def:' .private (<parser> tokens) (-> (List Code) (Maybe (List <item_type>))) (case tokens - #End - {#Some #End} + {#End} + {#Some {#End}} _ (do maybe_monad @@ -2594,7 +2515,7 @@ (do maybe_monad [% (local_identifierP tokens) .let' [[tokens' name] %]] - (in [tokens' [name #End]]))))] + (in [tokens' [name {#End}]]))))] [local_declarationP Text parametersP] [enhanced_local_declarationP Code enhanced_parametersP] @@ -2642,10 +2563,10 @@ ... B (^ (list& body tokens')) - {#Some [tokens' [#None body]]} + {#Some [tokens' [{#None} body]]} _ - #None)) + {#None})) (def:' .private (definitionP tokens) (-> (List Code) (Maybe [Code Text (List Code) (Maybe Code) Code])) @@ -2661,7 +2582,7 @@ (case (definitionP tokens) {#Some [export_policy name parameters ?type body]} (let [body (case parameters - #End + {#End} body _ @@ -2672,13 +2593,13 @@ (` (: (~ type) (~ body))) - #None + {#None} body)] (in_meta (list (` ("lux def" (~ (..local_identifier$ name)) (~ body) (~ export_policy)))))) - #None + {#None} (failure "Wrong syntax for def:"))) (def:' .private (macroP tokens) @@ -2696,7 +2617,7 @@ {#Some [export_policy name args body]} (let [name (local_identifier$ name) body (case args - #End + {#End} body _ @@ -2706,19 +2627,19 @@ (~ body) (~ export_policy)))))) - #None + {#None} (failure "Wrong syntax for macro:"))) (def: (list\one f xs) (All (_ a b) (-> (-> a (Maybe b)) (List a) (Maybe b))) (case xs - #End - #None + {#End} + {#None} {#Item x xs'} (case (f x) - #None + {#None} (list\one f xs') {#Some y} @@ -2752,10 +2673,10 @@ (^ (list else maybe)) (let [g!temp (: Code [dummy_location {#Identifier ["" ""]}]) code (` (case (~ maybe) - {#.Some (~ g!temp)} + {.#Some (~ g!temp)} (~ g!temp) - #.None + {.#None} (~ else)))] {#Right [state (list code)]}) @@ -2765,7 +2686,7 @@ (def: (text\all_split_by splitter input) (-> Text Text (List Text)) (case (..index splitter input) - #None + {#None} (list input) {#Some idx} @@ -2781,8 +2702,8 @@ (All (_ a) (-> Nat (List a) (Maybe a))) (case xs - #End - #None + {#End} + {#None} {#Item x xs'} (if ("lux i64 =" 0 idx) @@ -2804,7 +2725,7 @@ {#UnivQ ?local_env ?local_def} (case ?local_env - #End + {#End} {#UnivQ env ?local_def} _ @@ -2812,7 +2733,7 @@ {#ExQ ?local_env ?local_def} (case ?local_env - #End + {#End} {#ExQ env ?local_def} _ @@ -2854,7 +2775,7 @@ (applied_type param type) _ - #None)) + {#None})) (template [<name> <tag>] [(def: (<name> type) @@ -2902,7 +2823,7 @@ (interface_methods type) {#Sum _} - #None + {#None} _ {#Some (list type)})) @@ -2926,7 +2847,7 @@ (do meta_monad [=module (..module module) .let [[#module_hash _ #module_aliases _ #definitions definitions #imports _ #module_state _] =module]] - (case (plist\value (text\composite "#" name) definitions) + (case (plist\value name definitions) {#Some {#Slot [exported type group index]}} (in_meta [index (list\each (function (_ slot) @@ -2963,13 +2884,13 @@ members]}) _ - (in_meta #None)) + (in_meta {#None})) _ (record_slots unnamed))) _ - (in_meta #None))) + (in_meta {#None}))) (def: expected_type (Meta Type) @@ -2982,7 +2903,7 @@ {#Some type} {#Right state type} - #None + {#None} {#Left "Not expecting any type."})))) (def: (type\encoded type) @@ -2990,7 +2911,7 @@ (case type {#Primitive name params} (case params - #End + {#End} name _ @@ -3046,19 +2967,21 @@ "No tags available for type: " (type\encoded struct_type))))) .let [tag_mappings (: (List [Text Code]) - (list\each (function (_ tag) [(product\right tag) (tag$ tag)]) + (list\each (function (_ tag) + [(product\right tag) + (identifier$ tag)]) tags))] members (monad\each meta_monad (: (-> Code (Meta (List Code))) (function (_ token) (case token - (^ [_ {#Form (list [_ {#Text "lux def"}] [_ {#Identifier ["" tag_name]}] value export_policy)}]) - (case (plist\value tag_name tag_mappings) + (^ [_ {#Form (list [_ {#Text "lux def"}] [_ {#Identifier ["" slot_name]}] value export_policy)}]) + (case (plist\value slot_name tag_mappings) {#Some tag} (in (list tag value)) _ - (failure (text\composite "Unknown implementation member: " tag_name))) + (failure (text\composite "Unknown implementation member: " slot_name))) _ (failure "Invalid implementation member.")))) @@ -3068,7 +2991,7 @@ (def: (text\interposed separator parts) (-> Text (List Text) Text) (case parts - #End + {#End} "" {#Item head tail} @@ -3080,8 +3003,8 @@ (def: (remainderP tokens) (-> (List Code) (Maybe (List Code))) (case tokens - #End - #None + {#End} + {#None} _ {#Item tokens})) @@ -3100,7 +3023,7 @@ (case (implementationP tokens) {#Some [export_policy name args type definitions]} (let [usage (case args - #End + {#End} (local_identifier$ name) _ @@ -3110,7 +3033,7 @@ (implementation (~+ definitions))))))) - #None + {#None} (failure "Wrong syntax for implementation:"))) (def: (function\identity value) @@ -3131,24 +3054,24 @@ {#Item _} (everyP itP tokens') - #End + {#End} (in (list)))] (in (list& head tail))) - #End + {#End} {#Some (list)})) (def: (caseP tokens) (-> (List Code) (Maybe [(List Code) [Text Code]])) (case tokens - (^ (list& [_ {#Tag ["" niladic]}] tokens')) + (^ (list& [_ {#Variant (list [_ {#Identifier ["" niladic]}])}] tokens')) {#Some [tokens' [niladic (` .Any)]]} - (^ (list& [_ {#Variant (list& [_ {#Tag ["" polyadic]}] caseT)}] tokens')) + (^ (list& [_ {#Variant (list& [_ {#Identifier ["" polyadic]}] caseT)}] tokens')) {#Some [tokens' [polyadic (` (..Tuple (~+ caseT)))]]} _ - #None)) + {#None})) (macro: .public (Variant tokens) (case (everyP caseP tokens) @@ -3158,17 +3081,17 @@ (text$ (product\left case))) cases)))) - #None + {#None} (failure "Wrong syntax for Variant"))) (def: (slotP tokens) (-> (List Code) (Maybe [(List Code) [Text Code]])) (case tokens - (^ (list& [_ {#Tag ["" slot]}] type tokens')) + (^ (list& [_ {#Identifier ["" slot]}] type tokens')) {#Some [tokens' [slot type]]} _ - #None)) + {#None})) (macro: .public (Record tokens) (case tokens @@ -3180,7 +3103,7 @@ (text$ (product\left slot))) slots)))) - #None + {#None} (failure "Wrong syntax for Record")) _ @@ -3203,7 +3126,7 @@ {#Some [tokens' it]} _ - #None)) + {#None})) (def: (type_declaration it) (-> Code (Meta (Tuple Code (Maybe (Either (List Text) (List Text)))))) @@ -3216,7 +3139,7 @@ {#Some tags} (in_meta [type {#Some {#Left tags}}]) - #None + {#None} (failure "Improper type-definition syntax")) (^ (list type [_ {#Tuple slots}])) @@ -3224,17 +3147,17 @@ {#Some slots} (in_meta [type {#Some {#Right slots}}]) - #None + {#None} (failure "Improper type-definition syntax")) (^ (list type)) - (in_meta [it #None]) + (in_meta [it {#None}]) _ (failure "Improper type-definition syntax"))) type - (in_meta [type #None])} + (in_meta [type {#None}])} it)) (macro: .public (type: tokens) @@ -3247,7 +3170,7 @@ [type labels??] type+labels?? type' (: (Maybe Code) (case args - #End + {#End} {#Some type} _ @@ -3255,7 +3178,7 @@ (~ type)))}))]] (case type' {#Some type''} - (let [typeC (` {#.Named [(~ (text$ module_name)) + (let [typeC (` {.#Named [(~ (text$ module_name)) (~ (text$ name))] (.type (~ type''))})] (in_meta (list (case labels?? @@ -3276,10 +3199,10 @@ (~ typeC)) (~ export_policy))))))) - #None + {#None} (failure "Wrong syntax for type:"))) - #None + {#None} (failure "Wrong syntax for type:"))) (template [<name> <to>] @@ -3295,11 +3218,11 @@ (type: Referrals (Variant - #All + {#All} {#Only (List Text)} {#Exclude (List Text)} - #Ignore - #Nothing)) + {#Ignore} + {#Nothing})) (type: Openings [Text (List Text)]) @@ -3345,20 +3268,20 @@ (^or (^ (list& [_ {#Text "*"}] tokens')) (^ (list& [_ {#Text "all"}] tokens'))) - (in_meta [#All tokens']) + (in_meta [{#All} tokens']) (^or (^ (list& [_ {#Text "_"}] tokens')) (^ (list& [_ {#Text "ignore"}] tokens'))) - (in_meta [#Ignore tokens']) + (in_meta [{#Ignore} tokens']) _ - (in_meta [#Nothing tokens]))) + (in_meta [{#Nothing} tokens]))) (def: (openings_parser parts) (-> (List Code) (Meta [(List Openings) (List Code)])) (case parts - #End - (in_meta [#End #End]) + {#End} + (in_meta [{#End} {#End}]) (^ (list& [_ {#Form (list& [_ {#Text prefix}] structs)}] parts')) (do meta_monad @@ -3377,7 +3300,7 @@ remainder]))) _ - (in_meta [#End parts]))) + (in_meta [{#End} parts]))) (def: (text\split_at' at x) (-> Nat Text [Text Text]) @@ -3400,7 +3323,7 @@ {#Some [pre post]} (recur ($_ "lux text concat" left pre replacement) post) - #None + {#None} ("lux text concat" left right)))) "" template)) @@ -3443,12 +3366,12 @@ {#Some (normal_parallel_path' hierarchy root')} _ - #None)) + {#None})) (def: (relative_ups relatives input) (-> Nat Text Nat) (case ("lux text index" relatives ..module_separator input) - #None + {#None} relatives {#Some found} @@ -3459,7 +3382,7 @@ (def: (list\after amount list) (All (_ a) (-> Nat (List a) (List a))) (case [amount list] - (^or [0 _] [_ #End]) + (^or [0 _] [_ {#End}]) list [_ {#Item _ tail}] @@ -3504,8 +3427,8 @@ (do meta_monad [absolute_module_name (..absolute_module_name nested? relative_root module_name)] (in (list [#import_name absolute_module_name - #import_alias #None - #import_refer [#refer_defs #All + #import_alias {#None} + #import_refer [#refer_defs {#All} #refer_open (list)]]))) ... Nested @@ -3515,7 +3438,7 @@ {#Some parallel_path} (in parallel_path) - #None + {#None} (..absolute_module_name nested? relative_root module_name)) referral+extra (referrals_parser extra) .let [[referral extra] referral+extra] @@ -3523,12 +3446,12 @@ .let [[openings extra] openings+extra] sub_imports (imports_parser #1 absolute_module_name context extra)] (in (case [referral openings] - [#Nothing #End] + [{#Nothing} {#End}] sub_imports _ (list& [#import_name absolute_module_name - #import_alias #None + #import_alias {#None} #import_refer [#refer_defs referral #refer_open openings]] sub_imports)))) @@ -3539,7 +3462,7 @@ {#Some parallel_path} (in parallel_path) - #None + {#None} (..absolute_module_name nested? relative_root module_name)) referral+extra (referrals_parser extra) .let [[referral extra] referral+extra] @@ -3548,7 +3471,7 @@ 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] + [{#Ignore} {#End}] sub_imports _ @@ -3604,14 +3527,14 @@ definitions))] {#Right state (list\conjoint to_alias)}) - #None + {#None} {#Left ($_ text\composite "Unknown module: " (text\encoded module) ..\n "Current module: " (case current_module {#Some current_module} (text\encoded current_module) - #None + {#None} "???") ..\n "Known modules: " (|> modules (list\each (function (_ [name module]) @@ -3624,7 +3547,7 @@ (All (_ a) (-> (-> a Bit) (List a) (List a))) (case xs - #End + {#End} (list) {#Item x xs'} @@ -3645,7 +3568,7 @@ (All (_ a b) (-> (-> a (Maybe b)) a a (Maybe b))) (case (f x1) - #None (f x2) + {#None} (f x2) {#Some y} {#Some y})) (def: (in_env name state) @@ -3666,7 +3589,7 @@ (function (_ [bname [type _]]) (if (text\= name bname) {#Some type} - #None)))) + {#None})))) (: (List [Text [Type Any]]) locals) (: (List [Text [Type Any]]) closure))))) scopes))) @@ -3679,13 +3602,13 @@ #seed seed #expected expected #location location #extensions extensions #scope_type_vars scope_type_vars #eval _eval] state] (case (plist\value v_module modules) - #None - #None + {#None} + {#None} {#Some [#definitions definitions #module_hash _ #module_aliases _ #imports _ #module_state _]} (case (plist\value v_name definitions) - #None - #None + {#None} + {#None} {#Some definition} (case definition @@ -3699,10 +3622,10 @@ {#Some ..Type} {#Label _} - #None + {#None} {#Slot _} - #None))))) + {#None}))))) (def: (definition_value name state) (-> Name (Meta [Type Any])) @@ -3712,12 +3635,12 @@ #seed seed #expected expected #location location #extensions extensions #scope_type_vars scope_type_vars #eval _eval] state] (case (plist\value v_module modules) - #None + {#None} {#Left (text\composite "Unknown definition: " (name\encoded name))} {#Some [#definitions definitions #module_hash _ #module_aliases _ #imports _ #module_state _]} (case (plist\value v_name definitions) - #None + {#None} {#Left (text\composite "Unknown definition: " (name\encoded name))} {#Some definition} @@ -3740,8 +3663,8 @@ (def: (type_variable idx bindings) (-> Nat (List [Nat (Maybe Type)]) (Maybe Type)) (case bindings - #End - #End + {#End} + {#End} {#Item [var bound] bindings'} (if ("lux i64 =" idx var) @@ -3780,7 +3703,7 @@ #scope_type_vars _ #eval _eval] compiler [#ex_counter _ #var_counter _ #var_bindings var_bindings] type_context] (case (type_variable type_id var_bindings) - #None + {#None} temp {#Some actualT} @@ -3817,7 +3740,7 @@ [init_type (type_definition name) struct_evidence (record_slots init_type)] (case struct_evidence - #None + {#None} (failure (text\composite "Can only 'open' structs: " (type\encoded init_type))) {#Some tags&members} @@ -3825,12 +3748,18 @@ [full_body ((: (-> Name [(List Name) (List Type)] Code (Meta Code)) (function (recur source [tags members] target) (let [locals (list\each (function (_ [t_module t_name]) - ["" (..module_alias (list t_name) alias)]) + [[t_module t_name] + ["" (..module_alias (list t_name) alias)]]) tags) - pattern (tuple$ (list\each identifier$ locals))] + pattern (|> locals + (list\each (function (_ [slot binding]) + (list (identifier$ slot) + (identifier$ binding)))) + list\conjoint + tuple$)] (do meta_monad [enhanced_target (monad\mix meta_monad - (function (_ [m_local m_type] enhanced_target) + (function (_ [[_ m_local] m_type] enhanced_target) (do meta_monad [m_implementation (record_slots m_type)] (case m_implementation @@ -3839,7 +3768,7 @@ m_tags&members enhanced_target) - #None + {#None} (in enhanced_target)))) target (zipped/2 locals members))] @@ -3872,8 +3801,8 @@ {#Item x xs'} {#Item [idx x] (enumeration' ("lux i64 +" 1 idx) xs')} - #End - #End)) + {#End} + {#End})) (def: (enumeration xs) (All (_ a) @@ -3882,7 +3811,7 @@ (macro: .public (value@ tokens) (case tokens - (^ (list [_ {#Tag slot'}] record)) + (^ (list [_ {#Identifier slot'}] record)) (do meta_monad [slot (normal slot') output (..type_slot slot) @@ -3894,7 +3823,7 @@ (let [pattern (|> (zipped/2 tags (enumeration members)) (list\each (: (-> [Name [Nat Type]] (List Code)) (function (_ [[r_module r_name] [r_idx r_type]]) - (list (tag$ [r_module r_name]) + (list (identifier$ [r_module r_name]) (if ("lux i64 =" idx r_idx) g!output g!_))))) @@ -4008,7 +3937,7 @@ .let [[openings options] openings+options] current_module current_module_name] (case options - #End + {#End} (in [#refer_defs referral #refer_open openings]) @@ -4033,7 +3962,7 @@ (failure ($_ text\composite _def " is not defined in module " module_name " @ " current_module))))) referred_defs)))] defs' (case r_defs - #All + {#All} (exported_definitions module_name) {#Only +defs} @@ -4048,10 +3977,10 @@ _ (test_referrals module_name *defs _defs)] (in (..list\only (|>> (is_member? _defs) not) *defs))) - #Ignore + {#Ignore} (in (list)) - #Nothing + {#Nothing} (in (list))) .let [defs (list\each (: (-> Text Code) (function (_ def) @@ -4081,7 +4010,7 @@ (let [module_alias (..maybe\else module_name module_alias') localizations (: (List Code) (case r_defs - #All + {#All} (list (' "*")) {#Only defs} @@ -4090,10 +4019,10 @@ {#Exclude defs} (list (variant$ (list (' "-") (tuple$ (list\each local_identifier$ defs))))) - #Ignore + {#Ignore} (list) - #Nothing + {#Nothing} (list))) openings (list\each (function (_ [alias structs]) (form$ (list& (text$ (..module_alias (list (alias_stand_in 0) module_alias) alias)) @@ -4106,7 +4035,7 @@ (macro: .public (module: _imports) (do meta_monad [current_module current_module_name - imports (imports_parser #0 current_module #End _imports) + imports (imports_parser #0 current_module {#End} _imports) .let [=imports (|> imports (list\each (: (-> Importation Code) (function (_ [module_name m_alias =refer]) @@ -4132,7 +4061,7 @@ (macro: .public (with@ tokens) (case tokens - (^ (list [_ {#Tag slot'}] value record)) + (^ (list [_ {#Identifier slot'}] value record)) (do meta_monad [slot (normal slot') output (..type_slot slot) @@ -4150,14 +4079,14 @@ (let [pattern (|> pattern' (list\each (: (-> [Name Nat Code] (List Code)) (function (_ [r_slot_name r_idx r_var]) - (list (tag$ r_slot_name) + (list (identifier$ r_slot_name) r_var)))) list\conjoint tuple$) output (|> pattern' (list\each (: (-> [Name Nat Code] (List Code)) (function (_ [r_slot_name r_idx r_var]) - (list (tag$ r_slot_name) + (list (identifier$ r_slot_name) (if ("lux i64 =" idx r_idx) value r_var))))) @@ -4170,7 +4099,7 @@ (^ (list [_ {#Tuple slots}] value record)) (case slots - #End + {#End} (failure "Wrong syntax for with@") _ @@ -4189,7 +4118,7 @@ (function (_ [new_slot new_binding] [old_record accesses']) [(` (value@ (~ new_slot) (~ new_binding))) {#Item (list new_binding old_record) accesses'}])) - [record (: (List (List Code)) #End)] + [record (: (List (List Code)) {#End})] pairs) accesses (list\conjoint (list\reversed accesses'))]] (in (list (` (let [(~+ accesses)] @@ -4215,7 +4144,7 @@ (macro: .public (revised@ tokens) (case tokens - (^ (list [_ {#Tag slot'}] fun record)) + (^ (list [_ {#Identifier slot'}] fun record)) (do meta_monad [slot (normal slot') output (..type_slot slot) @@ -4233,14 +4162,14 @@ (let [pattern (|> pattern' (list\each (: (-> [Name Nat Code] (List Code)) (function (_ [r_slot_name r_idx r_var]) - (list (tag$ r_slot_name) + (list (identifier$ r_slot_name) r_var)))) list\conjoint tuple$) output (|> pattern' (list\each (: (-> [Name Nat Code] (List Code)) (function (_ [r_slot_name r_idx r_var]) - (list (tag$ r_slot_name) + (list (identifier$ r_slot_name) (if ("lux i64 =" idx r_idx) (` ((~ fun) (~ r_var))) r_var))))) @@ -4253,7 +4182,7 @@ (^ (list [_ {#Tuple slots}] fun record)) (case slots - #End + {#End} (failure "Wrong syntax for revised@") _ @@ -4301,11 +4230,11 @@ (list\each (function\composite apply (replacement_environment bindings'))) list\conjoint in)) - #None)))) + {#None})))) {#Some output} (in_meta (list\composite output branches)) - #None + {#None} (failure "Wrong syntax for ^template")) _ @@ -4325,13 +4254,13 @@ (All (_ a) (-> (List a) (List a) (List a))) (case xs - #End - #End + {#End} + {#End} {#Item x xs'} (case ys - #End - #End + {#End} + {#End} {#Item y ys'} (list& x y (interleaved xs' ys'))))) @@ -4340,30 +4269,30 @@ (-> Type Code) (case type {#Primitive name params} - (` {#.Primitive (~ (text$ name)) (~ (untemplated_list (list\each type_code params)))}) + (` {.#Primitive (~ (text$ name)) (~ (untemplated_list (list\each type_code params)))}) (^template [<tag>] [{<tag> left right} (` {<tag> (~ (type_code left)) (~ (type_code right))})]) - ([#.Sum] [#.Product] - [#.Function] - [#.Apply]) + ([.#Sum] [.#Product] + [.#Function] + [.#Apply]) (^template [<tag>] [{<tag> id} (` {<tag> (~ (nat$ id))})]) - ([#.Parameter] [#.Var] [#.Ex]) + ([.#Parameter] [.#Var] [.#Ex]) (^template [<tag>] [{<tag> env type} (let [env' (untemplated_list (list\each type_code env))] (` {<tag> (~ env') (~ (type_code type))}))]) - ([#.UnivQ] [#.ExQ]) + ([.#UnivQ] [.#ExQ]) {#Named [module name] anonymous} ... TODO: Generate the explicit type definition instead of using ... the "identifier$" shortcut below. - ... (` {#.Named [(~ (text$ module)) (~ (text$ name))] + ... (` {.#Named [(~ (text$ module)) (~ (text$ name))] ... (~ (type_code anonymous))}) (identifier$ [module name]))) @@ -4376,7 +4305,7 @@ {#Some [(local_identifier$ "recur") bindings body]} _ - #None)] + {#None})] (case ?params {#Some [name bindings body]} (let [pairs (pairs bindings) @@ -4387,7 +4316,7 @@ [inits' (: (Meta (List Name)) (case (monad\each maybe_monad identifier_name inits) {#Some inits'} (in_meta inits') - #None (failure "Wrong syntax for loop"))) + {#None} (failure "Wrong syntax for loop"))) init_types (monad\each meta_monad type_definition inits') expected ..expected_type] (in_meta (list (` (("lux type check" @@ -4406,7 +4335,7 @@ [(~+ (..interleaved vars aliases))] (~ body))))))))) - #None + {#None} (failure "Wrong syntax for loop")))) (macro: .public (^slots tokens) @@ -4416,13 +4345,13 @@ [slots (: (Meta [Name (List Name)]) (case (: (Maybe [Name (List Name)]) (do maybe_monad - [hslot (..tag_name hslot') - tslots (monad\each maybe_monad ..tag_name tslots')] + [hslot (..identifier_name hslot') + tslots (monad\each maybe_monad ..identifier_name tslots')] (in [hslot tslots]))) {#Some slots} (in_meta slots) - #None + {#None} (failure "Wrong syntax for ^slots"))) .let [[hslot tslots] slots] hslot (..normal hslot) @@ -4437,10 +4366,10 @@ pattern (|> tags (list\each (: (-> Name (List Code)) (function (_ [module name]) - (let [tag (tag$ [module name])] + (let [tag (identifier$ [module name])] (case (plist\value name slot_pairings) {#Some binding} (list tag binding) - #None (list tag g!_)))))) + {#None} (list tag g!_)))))) list\conjoint tuple$)]] (in_meta (list& pattern body branches))) @@ -4451,7 +4380,7 @@ (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 _}]) (list target) [_ {#Identifier [module name]}] @@ -4479,7 +4408,7 @@ [(~+ bindings')] (~+ bodies)))))) - #End + {#End} (in_meta bodies) _ @@ -4546,7 +4475,7 @@ [#Tuple]) _ - (\ meta_monad in_meta token) + (in_meta token) ... TODO: Figure out why this doesn't work: ... (\ meta_monad in token) )) @@ -4577,7 +4506,7 @@ (def: (multi_level_case^ levels) (-> (List Code) (Meta Multi_Level_Case)) (case levels - #End + {#End} (failure "Multi-level patterns cannot be empty.") {#Item init extras} @@ -4600,8 +4529,8 @@ (~+ (if bind? (list) - (list g!_ (` #.None)))))))) - (` {#.Some (~ body)}) + (list g!_ (` {.#None})))))))) + (` {.#Some (~ body)}) (: (List [Code Code]) (list\reversed levels)))] (list init_pattern inner_pattern_body))) @@ -4619,19 +4548,19 @@ expected ..expected_type g!temp (..identifier "temp")] (let [output (list g!temp - (` ({{#Some (~ g!temp)} + (` ({{.#Some (~ g!temp)} (~ g!temp) - #None + {.#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])) (~+ (if initial_bind? (list) - (list g!temp (` #.None)))))))))] + (list g!temp (` {.#None})))))))))] (in output))) _ @@ -4647,11 +4576,8 @@ (macro: .public (name_of tokens) (case tokens - (^template [<tag>] - [(^ (list [_ {<tag> [module name]}])) - (in_meta (list (` [(~ (text$ module)) (~ (text$ name))])))]) - ([#Identifier] - [#Tag]) + (^ (list [_ {#Identifier [module name]}])) + (in_meta (list (` [(~ (text$ module)) (~ (text$ name))]))) _ (failure (..wrong_syntax_error [..prelude_module "name_of"])))) @@ -4672,9 +4598,9 @@ [stvs ..scope_type_vars] (case (..item idx (list\reversed stvs)) {#Some var_id} - (in (list (` {#Ex (~ (nat$ var_id))}))) + (in (list (` {.#Ex (~ (nat$ var_id))}))) - #None + {#None} (failure (text\composite "Indexed-type does not exist: " (nat\encoded idx))))) _ @@ -4725,7 +4651,7 @@ (macro: .public (undefined tokens) (case tokens - #End + {#End} (do meta_monad [location ..location .let [[module line column] location @@ -4759,7 +4685,7 @@ {#Some [tokens' tuple]} _ - #None)) + {#None})) (def: (templateP tokens) (-> (List Code) (Maybe [Code Text (List Text) (List Code)])) @@ -4786,16 +4712,16 @@ ((~ (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)))]} (~ g!_) - {#.Left (~ (text$ (..wrong_syntax_error [this_module name])))})))))) + {.#Left (~ (text$ (..wrong_syntax_error [this_module name])))})))))) - #None + {#None} (failure (..wrong_syntax_error (name_of ..template:))))) (macro: .public (as_is tokens compiler) @@ -4807,7 +4733,7 @@ (|> input "lux text size" ("lux i64 =" 1))) (|> input ("lux text char" 0) nat$ list - [compiler] #Right) + [compiler] {#Right}) _ {#Left (..wrong_syntax_error (name_of ..char))})) @@ -4829,8 +4755,8 @@ 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)) _ @@ -4846,9 +4772,9 @@ (def: (target_pick target options default) (-> Text (List [Code Code]) (Maybe Code) (Meta (List Code))) (case options - #End + {#End} (case default - #None + {#None} (failure ($_ text\composite "No code for target platform: " target)) {#Some default} @@ -4868,7 +4794,7 @@ (n/% 2) ("lux i64 =" 0)) {#Some (pairs tokens)} - #None)) + {#None})) (macro: .public (for tokens) (do meta_monad @@ -4877,9 +4803,9 @@ (^ (list [_ {#Tuple options}])) (case (pairs' options) {#Some options} - (target_pick target options #None) + (target_pick target options {#None}) - #None + {#None} (failure (..wrong_syntax_error (name_of ..for)))) (^ (list [_ {#Tuple options}] default)) @@ -4887,7 +4813,7 @@ {#Some options} (target_pick target options {#Some default}) - #None + {#None} (failure (..wrong_syntax_error (name_of ..for)))) _ @@ -4935,18 +4861,18 @@ (def: (untemplated_list& last inits) (-> Code (List Code) Code) (case inits - #End + {#End} last {#Item [init inits']} - (` {#.Item (~ init) (~ (untemplated_list& last 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]}]}}] + {#Item [_ {#Form {#Item [[_ {#Identifier ["" "~+"]}] {#Item [spliced {#End}]}]}}] inits} (do meta_monad [=inits (monad\each meta_monad untemplated_pattern (list\reversed inits))] @@ -4957,9 +4883,9 @@ [=elems (monad\each meta_monad untemplated_pattern elems)] (in (` [(~ g!meta) {<tag> (~ (untemplated_list =elems))}])))))] - [#.Form untemplated_form] - [#.Tuple untemplated_tuple] - [#.Variant untemplated_variant] + [.#Form untemplated_form] + [.#Tuple untemplated_tuple] + [.#Variant untemplated_variant] ) (def: (untemplated_pattern pattern) @@ -4970,19 +4896,18 @@ (^template [<tag> <gen>] [[_ {<tag> value}] (in (` [(~ g!meta) {<tag> (~ (<gen> value))}]))]) - ([#.Bit bit$] - [#.Nat nat$] - [#.Int int$] - [#.Rev rev$] - [#.Frac frac$] - [#.Text text$] - [#.Tag name$] - [#.Identifier name$]) - - [_ {#Form {#Item [[_ {#Identifier ["" "~"]}] {#Item [unquoted #End]}]}}] + ([.#Bit bit$] + [.#Nat nat$] + [.#Int int$] + [.#Rev rev$] + [.#Frac frac$] + [.#Text text$] + [.#Identifier name$]) + + [_ {#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>] @@ -5051,7 +4976,7 @@ {#Some [tokens' [name type]]} _ - #None)) + {#None})) (macro: .public (Interface tokens) (do meta_monad @@ -5061,13 +4986,13 @@ (in (list (` (..Tuple (~+ (list\each product\right methods)))) (tuple$ (list\each (|>> product\left text$) methods)))) - #None + {#None} (failure "Wrong syntax for Interface")))) (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 "")))) diff --git a/stdlib/source/library/lux/abstract/apply.lux b/stdlib/source/library/lux/abstract/apply.lux index f1b2b9344..366e2e750 100644 --- a/stdlib/source/library/lux/abstract/apply.lux +++ b/stdlib/source/library/lux/abstract/apply.lux @@ -21,8 +21,8 @@ (Apply (All (_ a) (F (G a)))))) (def: &functor - (functor.composite (value@ #&functor f_apply) - (value@ #&functor g_apply))) + (functor.composite (value@ &functor f_apply) + (value@ &functor g_apply))) (def: (on fgx fgf) ... TODO: Switch from this version to the one below (in comments) ASAP. diff --git a/stdlib/source/library/lux/abstract/comonad.lux b/stdlib/source/library/lux/abstract/comonad.lux index 20e24bcb5..d649ea244 100644 --- a/stdlib/source/library/lux/abstract/comonad.lux +++ b/stdlib/source/library/lux/abstract/comonad.lux @@ -26,19 +26,19 @@ (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]} + {.#None})) + {.#Some [?name comonad bindings body]} (if (|> bindings list.size (n.% 2) (n.= 0)) (let [[module short] (name_of ..be) identifier (: (-> Text Code) - (|>> ($_ "lux text concat" module " " short " ") [""] #.Identifier [location.dummy])) + (|>> ($_ "lux text concat" module " " short " ") [""] {.#Identifier} [location.dummy])) g!_ (identifier "_") g!each (identifier "each") g!disjoint (identifier "disjoint") @@ -47,30 +47,30 @@ (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) [(~ g!each) (~' out) (~ g!disjoint)] (~ body'))))) - #.None + {.#None} (` (.case (~ comonad) [(~ g!each) (~' out) (~ g!disjoint)] (~ body')))))]}) - {#.Left "'be' bindings must have an even number of parts."}) + {.#Left "'be' bindings must have an even number of parts."}) - #.None - {#.Left "Wrong syntax for 'be'"})) + {.#None} + {.#Left "Wrong syntax for 'be'"})) diff --git a/stdlib/source/library/lux/abstract/enum.lux b/stdlib/source/library/lux/abstract/enum.lux index c78a0711f..1b86ebc1d 100644 --- a/stdlib/source/library/lux/abstract/enum.lux +++ b/stdlib/source/library/lux/abstract/enum.lux @@ -14,12 +14,12 @@ (All (_ a) (-> (Enum a) a a (List a))) (let [(^open "[0]") enum] (loop [end to - output #.End] + 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 5b7b4d3f1..36aab9aeb 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/interval.lux b/stdlib/source/library/lux/abstract/interval.lux index c39ac868c..a6337b770 100644 --- a/stdlib/source/library/lux/abstract/interval.lux +++ b/stdlib/source/library/lux/abstract/interval.lux @@ -76,21 +76,21 @@ (implementation: .public (union left right) (All (_ a) (-> (Interval a) (Interval a) (Interval a))) - (def: &enum (value@ #&enum right)) + (def: &enum (value@ &enum right)) (def: bottom (order.min (\ right &order) (\ left bottom) (\ right bottom))) (def: top (order.max (\ right &order) (\ left top) (\ right top)))) (implementation: .public (intersection left right) (All (_ a) (-> (Interval a) (Interval a) (Interval a))) - (def: &enum (value@ #&enum right)) + (def: &enum (value@ &enum right)) (def: bottom (order.max (\ right &order) (\ left bottom) (\ right bottom))) (def: top (order.min (\ right &order) (\ left top) (\ right top)))) (implementation: .public (complement interval) (All (_ a) (-> (Interval a) (Interval a))) - (def: &enum (value@ #&enum interval)) + (def: &enum (value@ &enum interval)) (def: bottom (\ interval succ (\ interval top))) (def: top (\ interval pred (\ interval bottom)))) diff --git a/stdlib/source/library/lux/abstract/monad.lux b/stdlib/source/library/lux/abstract/monad.lux index c915945a1..2aca8a09a 100644 --- a/stdlib/source/library/lux/abstract/monad.lux +++ b/stdlib/source/library/lux/abstract/monad.lux @@ -10,10 +10,10 @@ (All (_ a b) (-> (-> b a a) a (List b) a)) (case xs - #.End + {.#End} init - {#.Item x xs'} + {.#Item x xs'} (list\mix f (f x init) xs'))) (def: (list\size xs) @@ -21,27 +21,27 @@ (loop [counter 0 xs xs] (case xs - #.End + {.#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}) - #.End + (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)) + {.#End})) (type: .public (Monad m) (Interface @@ -57,19 +57,19 @@ (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]} + {.#None})) + {.#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) - (|>> ($_ "lux text concat" module " " short " ") [""] #.Identifier [location.dummy])) + (|>> ($_ "lux text concat" module " " short " ") [""] {.#Identifier} [location.dummy])) g!_ (identifier "_") g!each (identifier "each") g!conjoint (identifier "conjoint") @@ -78,33 +78,33 @@ (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) [(~ g!each) (~' in) (~ g!conjoint)] (~ body'))))) - #.None + {.#None} (` (.case (~ monad) [(~ g!each) (~' in) (~ g!conjoint)] (~ body')))))]}) - {#.Left "'do' bindings must have an even number of parts."}) + {.#Left "'do' bindings must have an even number of parts."}) - #.None - {#.Left "Wrong syntax for 'do'"})) + {.#None} + {.#Left "Wrong syntax for 'do'"})) (def: .public (then monad f) (All (_ ! a b) @@ -120,13 +120,13 @@ (let [(^open "!\[0]") monad] (function (recur xs) (case xs - #.End - (!\in #.End) + {.#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) @@ -136,13 +136,13 @@ (let [(^open "!\[0]") monad] (function (recur xs) (case xs - #.End - (!\in #.End) + {.#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) @@ -152,15 +152,15 @@ (let [(^open "!\[0]") monad] (function (recur xs) (case xs - #.End - (!\in #.End) + {.#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))))) @@ -170,10 +170,10 @@ (-> (Monad M) (-> b a (M a)) a (List b) (M a))) (case xs - #.End + {.#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/indexed.lux b/stdlib/source/library/lux/abstract/monad/indexed.lux index 3051aba52..8a6b6818b 100644 --- a/stdlib/source/library/lux/abstract/monad/indexed.lux +++ b/stdlib/source/library/lux/abstract/monad/indexed.lux @@ -55,10 +55,10 @@ (def: named_monad (Parser [(Maybe Text) Code]) - (<>.either (<code>.tuple (<>.and (\ <>.monad each (|>> #.Some) + (<>.either (<code>.tuple (<>.and (\ <>.monad each (|>> {.#Some}) <code>.local_identifier) <code>.any)) - (\ <>.monad each (|>> [#.None]) + (\ <>.monad each (|>> [{.#None}]) <code>.any))) (syntax: .public (do [[?name monad] ..named_monad @@ -80,14 +80,14 @@ expression (list.reversed context))] (in (list (case ?name - {#.Some name} + {.#Some name} (let [name (code.local_identifier name)] (` (let [(~ name) (~ monad) - [#..in (~' in) - #..then (~ g!then)] (~ name)] + [..in (~' in) + ..then (~ g!then)] (~ name)] (~ body)))) - #.None - (` (let [[#..in (~' in) - #..then (~ g!then)] (~ monad)] + {.#None} + (` (let [[..in (~' in) + ..then (~ g!then)] (~ monad)] (~ body))))))))) diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux index 2e70ed49e..4d377e5c5 100644 --- a/stdlib/source/library/lux/control/concatenative.lux +++ b/stdlib/source/library/lux/control/concatenative.lux @@ -52,7 +52,7 @@ (Parser Stack) (<>.either (<>.and (<>.maybe bottom^) ..top^) - (<>.and (<>\each (|>> #.Some) bottom^) + (<>.and (<>\each (|>> {.#Some}) bottom^) (<>\in (list))))) (def: (stack_mix tops bottom) @@ -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)))] diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux index c275d546f..64ab1c283 100644 --- a/stdlib/source/library/lux/control/concurrency/actor.lux +++ b/stdlib/source/library/lux/control/concurrency/actor.lux @@ -54,12 +54,12 @@ (do [! io.monad] [current (async.value read)] (case current - {#.Some [head tail]} - (\ ! each (|>> {#.Item head}) + {.#Some [head tail]} + (\ ! each (|>> {.#Item head}) (pending tail)) - #.None - (in #.End)))) + {.#None} + (in {.#End})))) (abstract: .public (Actor s) (Record @@ -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))) @@ -112,7 +112,7 @@ (|> obituary async.value (\ io.functor each - (|>> (case> #.None + (|>> (case> {.#None} bit.yes _ @@ -141,16 +141,16 @@ (do ! [|mailbox| (async.value |mailbox|)] (case |mailbox| - #.None + {.#None} (do ! [resolved? (resolve entry)] (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}))))) ) ) @@ -240,10 +240,10 @@ (def: (on_mail g!_ ?on_mail) (-> Code (Maybe On_MailC) Code) (case ?on_mail - #.None + {.#None} (` (~! ..default_on_mail)) - {#.Some [[mailN stateN selfN] bodyC]} + {.#Some [[mailN stateN selfN] bodyC]} (` (function ((~ g!_) (~ (code.local_identifier mailN)) (~ (code.local_identifier stateN)) @@ -270,8 +270,8 @@ (def: (~ export_policy) (~ g!actor) (All ((~ g!_) (~+ g!vars)) (..Behavior (~ state_type) ((~ g!type) (~+ g!vars)))) - [#..on_init (|>> ((~! abstract.:abstraction) (~ g!type))) - #..on_mail (~ (..on_mail g!_ ?on_mail))]) + [..#on_init (|>> ((~! abstract.:abstraction) (~ g!type))) + ..#on_mail (~ (..on_mail g!_ ?on_mail))]) (~+ messages)))))))) @@ -280,8 +280,8 @@ (with_identifiers [g!_] (in (list (` (: ((~! io.IO) (..Actor (~ state_type))) (..spawn! (: (..Behavior (~ state_type) (~ state_type)) - [#..on_init (|>>) - #..on_mail (~ (..on_mail g!_ ?on_mail))]) + [..#on_init (|>>) + ..#on_mail (~ (..on_mail g!_ ?on_mail))]) (: (~ state_type) (~ init))))))))) @@ -319,9 +319,9 @@ (with_identifiers [g!_ g!return] (do meta.monad [actor_scope abstract.current - .let [g!type (code.local_identifier (value@ #abstract.name actor_scope)) + .let [g!type (code.local_identifier (value@ abstract.#name actor_scope)) g!message (code.local_identifier (value@ #name signature)) - g!actor_vars (value@ #abstract.type_vars actor_scope) + g!actor_vars (value@ abstract.#type_vars actor_scope) g!all_vars (|> signature (value@ #vars) (list\each code.local_identifier) (list\composite g!actor_vars)) g!inputsC (|> signature (value@ #inputs) (list\each product.left)) g!inputsT (|> signature (value@ #inputs) (list\each product.right)) @@ -330,15 +330,15 @@ (in (list (` (def: (~ export_policy) ((~ g!message) (~+ g!inputsC)) (All ((~ g!_) (~+ g!all_vars)) (-> (~+ g!inputsT) - (..Message (~ (value@ #abstract.abstraction actor_scope)) + (..Message (~ (value@ abstract.#abstraction actor_scope)) (~ output_type)))) (function ((~ g!_) (~ g!state) (~ g!self)) - (let [(~ g!state) (:as (~ (value@ #abstract.representation actor_scope)) + (let [(~ g!state) (:as (~ (value@ abstract.#representation actor_scope)) (~ g!state))] (|> (~ body) - (: ((~! async.Async) ((~! try.Try) [(~ (value@ #abstract.representation actor_scope)) + (: ((~! async.Async) ((~! try.Try) [(~ (value@ abstract.#representation actor_scope)) (~ output_type)]))) - (:as ((~! async.Async) ((~! try.Try) [(~ (value@ #abstract.abstraction actor_scope)) + (:as ((~! async.Async) ((~! try.Try) [(~ (value@ abstract.#abstraction actor_scope)) (~ output_type)])))))))) ))))) @@ -361,5 +361,5 @@ (|> actor (..mail! (action event stop)) (\ ! each try.maybe)) - (in #.None)))) + (in {.#None})))) channel))) diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux index 477870a86..0342da425 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 + {.#None} (do ! - [.let [new [{#.Some value} #.None]] + [.let [new [{.#Some value} {.#None}]] succeeded? (atom.compare_and_swap! old new async)] (if succeeded? (do ! @@ -47,11 +47,11 @@ (def: .public (resolved value) (All (_ a) (-> a (Async a))) - (:abstraction (atom [{#.Some value} (list)]))) + (:abstraction (atom [{.#Some value} (list)]))) (def: .public (async _) (All (_ a) (-> Any [(Async a) (Resolver a)])) - (let [async (:abstraction (atom [#.None (list)]))] + (let [async (:abstraction (atom [{.#None} (list)]))] [async (..resolver async)])) (def: .public value @@ -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}]] + {.#None} + (let [new [_value {.#Item f _observers}]] (do ! [swapped? (atom.compare_and_swap! old new async)] (if swapped? @@ -82,10 +82,10 @@ (All (_ a) (-> (Async a) (IO Bit))) (|>> ..value (\ io.functor each - (|>> (case> #.None + (|>> (case> {.#None} #0 - {#.Some _} + {.#Some _} #1))))) (implementation: .public functor @@ -144,10 +144,10 @@ (let [[a|b resolve] (..async [])] (with_expansions [<sides> (template [<async> <tag>] - [(io.run! (upon! (|>> <tag> resolve) <async>))] + [(io.run! (upon! (|>> {<tag>} resolve) <async>))] - [left #.Left] - [right #.Right] + [left .#Left] + [right .#Right] )] (exec <sides> diff --git a/stdlib/source/library/lux/control/concurrency/frp.lux b/stdlib/source/library/lux/control/concurrency/frp.lux index 5498eeb06..ebf3728ca 100644 --- a/stdlib/source/library/lux/control/concurrency/frp.lux +++ b/stdlib/source/library/lux/control/concurrency/frp.lux @@ -39,10 +39,10 @@ (loop [_ []] (do [! io.monad] [current (atom.read! sink) - stopped? (current #.None)] + 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,15 +102,15 @@ [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))))) + (in {.#None}))))) (def: empty Channel - (async.resolved #.None)) + (async.resolved {.#None})) (implementation: .public monad (Monad Channel) @@ -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,22 +128,22 @@ (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')) - #.None + {.#None} (in []))))] (recur mma')) - #.None + {.#None} (in (: Any (io.run! (\ sink close)))))))) output)))) @@ -158,15 +158,15 @@ (do async.monad [item channel] (case item - {#.Some [head tail]} + {.#Some [head tail]} (case (io.run! (subscriber head)) - {#.Some _} + {.#Some _} (recur tail) - #.None + {.#None} (in [])) - #.None + {.#None} (in []))))) []))) @@ -175,19 +175,19 @@ (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 - (in #.None)))) + {.#None} + (in {.#None})))) (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) @@ -197,10 +197,10 @@ (do [! async.monad] [item channel] (case item - #.None + {.#None} (in init) - {#.Some [head tail]} + {.#Some [head tail]} (do ! [init' (f head init)] (mix f init' tail))))) @@ -212,13 +212,13 @@ (do [! async.monad] [item channel] (case item - #.None - (in {#.Some [init (in #.None)]}) + {.#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,55 +241,55 @@ (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)))) + {.#None} + (in {.#None})))) (def: (distinct' equivalence previous channel) (All (_ a) (-> (Equivalence a) a (Channel a) (Channel a))) (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)))) + {.#None} + (in {.#None})))) (def: .public (distinct equivalence channel) (All (_ a) (-> (Equivalence a) (Channel a) (Channel a))) (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)))) + {.#None} + {.#None})))) (def: .public (list channel) (All (_ a) (-> (Channel a) (Async (List a)))) (do [! async.monad] [item channel] (case item - {#.Some [head tail]} - (\ ! each (|>> {#.Item head}) + {.#Some [head tail]} + (\ ! each (|>> {.#Item head}) (list tail)) - #.None - (in #.End)))) + {.#None} + (in {.#End})))) (def: .public (sequential milli_seconds values) (All (_ a) (-> Nat (List a) (Channel a))) (case values - #.End + {.#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))]}))) diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux index 1a0ef82f9..268cf3736 100644 --- a/stdlib/source/library/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux @@ -86,12 +86,12 @@ (in (exception.except ..semaphore_is_maxed_out [(value@ #max_positions pre)])) (do ! [_ (case (queue.front (value@ #waiting_list pre)) - #.None + {.#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 6e468b90a..d2355b689 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,28 +99,28 @@ (All (_ a) (-> (Var a) (STM a))) (function (_ tx) (case (var_value var tx) - {#.Some value} + {.#Some value} [tx value] - #.None + {.#None} (let [value (..read! var)] - [{#.Item [var value value] tx} + [{.#Item [var value value] tx} value])))) (def: (with_updated_var var value tx) (All (_ a) (-> (Var a) a Tx Tx)) (case tx - #.End - #.End + {.#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 + {.#Item [#var _var #original _original #current _current] (with_updated_var var value tx')}))) @@ -129,12 +129,12 @@ (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} + {.#None} + [{.#Item [var (..read! var) value] tx} []]))) (implementation: .public functor @@ -216,14 +216,14 @@ (do ! [|commits| (async.value |commits|)] (case |commits| - #.None + {.#None} (do io.monad [resolved? (resolve entry)] (if resolved? (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 f52b7f319..5696bcdc9 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,7 +129,7 @@ ... 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]}) ..runner)] @@ -152,7 +152,7 @@ [threads (atom.read! ..runner)] (case threads ... And... we're done! - #.End + {.#End} (in []) _ diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux index 5c8231e72..455318e39 100644 --- a/stdlib/source/library/lux/control/exception.lux +++ b/stdlib/source/library/lux/control/exception.lux @@ -40,40 +40,40 @@ (-> (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})))) + {//.#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) (All (_ e) (-> (Exception e) e Text)) - ((value@ #..constructor exception) message)) + ((value@ ..#constructor exception) message)) (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 @@ -99,10 +99,10 @@ (in (list (` (def: (~ export_policy) (~ g!self) (All ((~ g!_) (~+ (list\each |type_variable|.format t_vars))) - (..Exception [(~+ (list\each (value@ #|input|.type) inputs))])) + (..Exception [(~+ (list\each (value@ |input|.#type) inputs))])) (let [(~ g!descriptor) (~ (code.text descriptor))] - [#..label (~ g!descriptor) - #..constructor (function ((~ g!self) [(~+ (list\each (value@ #|input|.binding) inputs))]) + [..#label (~ g!descriptor) + ..#constructor (function ((~ g!self) [(~+ (list\each (value@ |input|.#binding) inputs))]) ((~! text\composite) (~ g!descriptor) (~ (maybe.else (' "") body))))])))))))) @@ -128,10 +128,10 @@ (text.replaced text.new_line on_new_line) ($_ text\composite padding header header_separator)))))] (case entries - #.End + {.#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,9 +148,9 @@ (|> entries (list\mix (function (_ entry [index next]) [(++ index) - {#.Item [(n\encoded index) (format entry)] + {.#Item [(n\encoded index) (format entry)] next}]) - [0 #.End]) + [0 {.#End}]) product.right list.reversed ..report')) @@ -173,8 +173,8 @@ (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) diff --git a/stdlib/source/library/lux/control/function/memo.lux b/stdlib/source/library/lux/control/function/memo.lux index cccc36bf4..f5d32635f 100644 --- a/stdlib/source/library/lux/control/function/memo.lux +++ b/stdlib/source/library/lux/control/function/memo.lux @@ -23,10 +23,10 @@ (do [! state.monad] [memory state.get] (case (dictionary.value input memory) - {#.Some output} + {.#Some output} (in output) - #.None + {.#None} (do ! [output (delegate input) _ (state.update (dictionary.has input output))] diff --git a/stdlib/source/library/lux/control/function/mutual.lux b/stdlib/source/library/lux/control/function/mutual.lux index 820d40253..282779593 100644 --- a/stdlib/source/library/lux/control/function/mutual.lux +++ b/stdlib/source/library/lux/control/function/mutual.lux @@ -55,11 +55,11 @@ (syntax: .public (let [functions (<code>.tuple (<>.some ..mutual)) body <code>.any]) (case functions - #.End + {.#End} (in (list body)) - {#.Item mutual #.End} - (.let [g!name (|> mutual (value@ [#declaration #declaration.name]) code.local_identifier)] + {.#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))) (~ (value@ #body mutual))))] @@ -77,10 +77,10 @@ context_types (list\each (function (_ mutual) (` (-> (~ g!context) (~ (value@ #type mutual))))) functions) - user_names (list\each (|>> (value@ [#declaration #declaration.name]) code.local_identifier) + user_names (list\each (|>> (value@ [#declaration declaration.#name]) code.local_identifier) functions)] g!pop (local.push (list\each (function (_ [g!name mutual]) - [[here_name (value@ [#declaration #declaration.name] mutual)] + [[here_name (value@ [#declaration declaration.#name] mutual)] (..macro g!context g!name)]) (list.zipped/2 hidden_names functions)))] @@ -107,15 +107,15 @@ (syntax: .public (def: [functions (<>.many ..definition)]) (case functions - #.End + {.#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)) - (~ type) - (~ body)))))) + (^slots [#declaration #type #body]) #mutual] + (in (list (` (.def: (~ #export_policy) (~ (declaration.format #declaration)) + (~ #type) + (~ #body)))))) _ (macro.with_identifiers [g!context g!output] @@ -129,10 +129,10 @@ context_types (list\each (function (_ mutual) (` (-> (~ g!context) (~ (value@ [#mutual #type] mutual))))) functions) - user_names (list\each (|>> (value@ [#mutual #declaration #declaration.name]) code.local_identifier) + user_names (list\each (|>> (value@ [#mutual #declaration declaration.#name]) code.local_identifier) functions)] g!pop (local.push (list\each (function (_ [g!name mutual]) - [[here_name (value@ [#mutual #declaration #declaration.name] mutual)] + [[here_name (value@ [#mutual #declaration declaration.#name] mutual)] (..macro g!context g!name)]) (list.zipped/2 hidden_names functions)))] @@ -147,7 +147,7 @@ user_names))]))) g!pop (list\each (function (_ mutual) - (.let [g!name (|> mutual (value@ [#mutual #declaration #declaration.name]) code.local_identifier)] + (.let [g!name (|> mutual (value@ [#mutual #declaration declaration.#name]) code.local_identifier)] (` (.def: (~ (value@ #export_policy mutual)) (~ g!name) diff --git a/stdlib/source/library/lux/control/lazy.lux b/stdlib/source/library/lux/control/lazy.lux index 5819243a4..f827e65a3 100644 --- a/stdlib/source/library/lux/control/lazy.lux +++ b/stdlib/source/library/lux/control/lazy.lux @@ -22,16 +22,16 @@ (def: (lazy' generator) (All (_ a) (-> (-> [] a) (Lazy a))) - (let [cache (atom.atom #.None)] + (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 0387618a8..2deaa50d2 100644 --- a/stdlib/source/library/lux/control/maybe.lux +++ b/stdlib/source/library/lux/control/maybe.lux @@ -12,29 +12,30 @@ ["[0]" location]]]]) ... (type: (Maybe a) -... #.None -... {#.Some a}) +... {.#None} +... {.#Some a}) (implementation: .public monoid (All (_ a) (Monoid (Maybe a))) - (def: identity #.None) + (def: identity + {.#None}) (def: (composite mx my) (case mx - #.None + {.#None} my - {#.Some x} - {#.Some x}))) + {.#Some x} + {.#Some x}))) (implementation: .public functor (Functor Maybe) (def: (each f ma) (case ma - #.None #.None - {#.Some a} {#.Some (f a)}))) + {.#None} {.#None} + {.#Some a} {.#Some (f a)}))) (implementation: .public apply (Apply Maybe) @@ -43,11 +44,11 @@ (def: (on fa ff) (case [ff fa] - [{#.Some f} {#.Some a}] - {#.Some (f a)} + [{.#Some f} {.#Some a}] + {.#Some (f a)} _ - #.None))) + {.#None}))) (implementation: .public monad (Monad Maybe) @@ -55,14 +56,14 @@ (def: &functor ..functor) (def: (in x) - {#.Some x}) + {.#Some x}) (def: (conjoint mma) (case mma - #.None - #.None + {.#None} + {.#None} - {#.Some mx} + {.#Some mx} mx))) (implementation: .public (equivalence super) @@ -70,10 +71,10 @@ (def: (= mx my) (case [mx my] - [#.None #.None] + [{.#None} {.#None}] #1 - [{#.Some x} {#.Some y}] + [{.#Some x} {.#Some y}] (\ super = x y) _ @@ -87,17 +88,17 @@ (def: (hash value) (case value - #.None + {.#None} 0 - {#.Some value} + {.#Some value} (\ super hash value)))) (implementation: .public (with monad) (All (_ M) (-> (Monad M) (Monad (All (_ a) (M (Maybe a)))))) (def: &functor - (functor.composite (value@ #monad.&functor monad) + (functor.composite (value@ monad.&functor monad) ..functor)) (def: in (|>> (\ ..monad in) (\ monad in))) @@ -106,10 +107,10 @@ (do monad [mMma MmMma] (case mMma - #.None - (in #.None) + {.#None} + (in {.#None}) - {#.Some Mma} + {.#Some Mma} Mma)))) (def: .public (lifted monad) @@ -119,16 +120,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 + {.#None} (~ else))))]}) _ - {#.Left "Wrong syntax for else"})) + {.#Left "Wrong syntax for else"})) (def: .public trusted (All (_ a) (-> (Maybe a) a)) @@ -137,18 +138,18 @@ (def: .public (list value) (All (_ a) (-> (Maybe a) (List a))) (case value - #.None - #.End + {.#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 17731a079..3d78dd546 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')))) @@ -143,7 +143,7 @@ (-> (Parser s a) (Parser s (List a)))) (|> (..some parser) (..and parser) - (\ ..monad each (|>> #.Item)))) + (\ ..monad each (|>> {.#Item})))) (def: .public (exactly amount parser) (All (_ s a) (-> Nat (Parser s a) (Parser s (List a)))) @@ -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'))))) @@ -189,54 +189,54 @@ (do [! ..monad] [?x (..maybe parser)] (case ?x - #.None - (in #.End) + {.#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 0c5f47cb3..03b29e3f3 100644 --- a/stdlib/source/library/lux/control/parser/analysis.lux +++ b/stdlib/source/library/lux/control/parser/analysis.lux @@ -53,39 +53,39 @@ (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 (Parser Analysis) (function (_ input) (case input - #.End + {.#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 - #.End true - _ false)]})) + {try.#Success [tokens (case tokens + {.#End} true + _ 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 0f5e925e1..c37298d24 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!] @@ -122,8 +122,8 @@ (def: .public (or left right) (All (_ l r) (-> (Parser l) (Parser r) (Parser (Or l r)))) - (!variant [[0 [#.Left] left] - [1 [#.Right] right]])) + (!variant [[0 [.#Left] left] + [1 [.#Right] right]])) (def: .public (rec body) (All (_ a) (-> (-> (Parser a) (Parser a)) (Parser a))) @@ -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]])))))) @@ -246,17 +246,17 @@ (let [pair (//.and type type) indexed ..nat quantified (//.and (..list type) type)] - (!variant [[0 [#.Primitive] (//.and ..text (..list type))] - [1 [#.Sum] pair] - [2 [#.Product] pair] - [3 [#.Function] pair] - [4 [#.Parameter] indexed] - [5 [#.Var] indexed] - [6 [#.Ex] indexed] - [7 [#.UnivQ] quantified] - [8 [#.ExQ] quantified] - [9 [#.Apply] pair] - [10 [#.Named] (//.and ..name type)]]))))) + (!variant [[0 [.#Primitive] (//.and ..text (..list type))] + [1 [.#Sum] pair] + [2 [.#Product] pair] + [3 [.#Function] pair] + [4 [.#Parameter] indexed] + [5 [.#Var] indexed] + [6 [.#Ex] indexed] + [7 [.#UnivQ] quantified] + [8 [.#ExQ] quantified] + [9 [.#Apply] pair] + [10 [.#Named] (//.and ..name type)]]))))) (def: .public location (Parser Location) @@ -268,14 +268,13 @@ (function (_ recur) (let [sequence (..list recur)] (//.and ..location - (!variant [[00 [#.Bit] ..bit] - [01 [#.Nat] ..nat] - [02 [#.Int] ..int] - [03 [#.Rev] ..rev] - [04 [#.Frac] ..frac] - [05 [#.Text] ..text] - [06 [#.Identifier] ..name] - [07 [#.Tag] ..name] - [08 [#.Form] sequence] - [09 [#.Variant] sequence] - [10 [#.Tuple] sequence]])))))) + (!variant [[0 [.#Bit] ..bit] + [1 [.#Nat] ..nat] + [2 [.#Int] ..int] + [3 [.#Rev] ..rev] + [4 [.#Frac] ..frac] + [5 [.#Text] ..text] + [6 [.#Identifier] ..name] + [7 [.#Form] sequence] + [8 [.#Variant] sequence] + [9 [.#Tuple] sequence]])))))) diff --git a/stdlib/source/library/lux/control/parser/cli.lux b/stdlib/source/library/lux/control/parser/cli.lux index aca4512fb..f68605f14 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} + {.#End} + {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} + {.#End} + {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 d58874cf4..4e31cb1b4 100644 --- a/stdlib/source/library/lux/control/parser/code.lux +++ b/stdlib/source/library/lux/control/parser/code.lux @@ -24,8 +24,8 @@ (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')))) + {.#End} {.#End} + {.#Item [[x y] pairs']} (list& x y (un_paired pairs')))) (type: .public Parser (//.Parser (List Code))) @@ -40,30 +40,30 @@ (Parser Code) (function (_ tokens) (case tokens - #.End - {#try.Failure "There are no tokens to parse!"} + {.#End} + {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!"} + {.#End} + {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,45 +72,44 @@ (-> <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>) _ <failure>))))] - [bit bit! Bit #.Bit bit.equivalence "bit"] - [nat nat! Nat #.Nat nat.equivalence "nat"] - [int int! Int #.Int int.equivalence "int"] - [rev rev! Rev #.Rev rev.equivalence "rev"] - [frac frac! Frac #.Frac frac.equivalence "frac"] - [text text! Text #.Text text.equivalence "text"] - [identifier identifier! Name #.Identifier name.equivalence "identifier"] - [tag tag! Name #.Tag name.equivalence "tag"] + [bit bit! Bit .#Bit bit.equivalence "bit"] + [nat nat! Nat .#Nat nat.equivalence "nat"] + [int int! Int .#Int int.equivalence "int"] + [rev rev! Rev .#Rev rev.equivalence "rev"] + [frac frac! Frac .#Frac frac.equivalence "frac"] + [text text! Text .#Text text.equivalence "text"] + [identifier identifier! Name .#Identifier name.equivalence "identifier"] ) (def: .public (this! code) (-> 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) + {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,16 +118,15 @@ (-> 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>) _ <failure>))))] - [local_identifier local_identifier! #.Identifier text.equivalence "local identifier"] - [ local_tag local_tag! #.Tag text.equivalence "local tag"] + [local_identifier local_identifier! .#Identifier text.equivalence "local identifier"] ) (template [<name> <tag> <desc>] @@ -137,46 +135,46 @@ (-> (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"] - [tuple #.Tuple "tuple"] + [form .#Form "form"] + [variant .#Variant "variant"] + [tuple .#Tuple "tuple"] ) (def: .public end! (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 - #.End true - _ false)]})) + {try.#Success [tokens (case tokens + {.#End} true + _ 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} + {.#End} + {try.#Success value} _ - {#try.Failure (|> unconsumed + {try.#Failure (|> unconsumed (list\each code.format) (text.interposed ", ") (text\composite "Unconsumed inputs: "))}))) @@ -195,5 +193,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 ce254222e..b6a788e24 100644 --- a/stdlib/source/library/lux/control/parser/environment.lux +++ b/stdlib/source/library/lux/control/parser/environment.lux @@ -33,10 +33,10 @@ (-> Property (Parser Text)) (function (_ environment) (case (dictionary.value name environment) - {#.Some value} - {#try.Success [environment value]} + {.#Some value} + {try.#Success [environment value]} - #.None + {.#None} (exception.except ..unknown_property [name])))) (def: .public (result parser environment) diff --git a/stdlib/source/library/lux/control/parser/json.lux b/stdlib/source/library/lux/control/parser/json.lux index 3a0d76c1f..979d7c8a8 100644 --- a/stdlib/source/library/lux/control/parser/json.lux +++ b/stdlib/source/library/lux/control/parser/json.lux @@ -34,26 +34,26 @@ (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} + {.#End} + {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) (<| (function (_ inputs)) (case inputs - #.End + {.#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 @@ -71,10 +71,10 @@ _ (//.failure (exception.error ..unexpected_value [head])))))] - [null /.Null #/.Null] - [boolean /.Boolean #/.Boolean] - [number /.Number #/.Number] - [string /.String #/.String] + [null /.Null /.#Null] + [boolean /.Boolean /.#Boolean] + [number /.Number /.#Number] + [string /.String /.#String] ) (exception: .public [a] (value_mismatch [reference JSON @@ -108,9 +108,9 @@ _ (//.failure (exception.error ..unexpected_value [head])))))] - [boolean? boolean! /.Boolean bit.equivalence #/.Boolean] - [number? number! /.Number frac.equivalence #/.Number] - [string? string! /.String text.equivalence #/.String] + [boolean? boolean! /.Boolean bit.equivalence /.#Boolean] + [number? number! /.Number frac.equivalence /.#Number] + [string? string! /.String text.equivalence /.#String] ) (def: .public (nullable parser) @@ -123,14 +123,14 @@ (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 + {.#End} (in output) _ @@ -144,19 +144,19 @@ (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 + {.#End} (in output) _ @@ -169,23 +169,23 @@ (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 + {.#End} (exception.except ..empty_input []) _ diff --git a/stdlib/source/library/lux/control/parser/synthesis.lux b/stdlib/source/library/lux/control/parser/synthesis.lux index 1578f9115..0a8db3267 100644 --- a/stdlib/source/library/lux/control/parser/synthesis.lux +++ b/stdlib/source/library/lux/control/parser/synthesis.lux @@ -53,38 +53,38 @@ (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 (Parser Synthesis) (.function (_ input) (case input - #.End + {.#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 []]} - _ (exception.except ..expected_empty_input [tokens])))) + {.#End} {try.#Success [tokens []]} + _ (exception.except ..expected_empty_input [tokens])))) (def: .public end? (Parser Bit) (.function (_ tokens) - {#try.Success [tokens (case tokens - #.End true - _ false)]})) + {try.#Success [tokens (case tokens + {.#End} true + _ 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 8594dc353..b887806ba 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,8 +97,8 @@ (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]]} @@ -110,7 +110,7 @@ (All (_ a) (-> (Parser a) (Parser <type>))) (function (_ input) (case (parser input) - {#try.Failure msg} + {try.#Failure msg} (<any> input) _ @@ -128,9 +128,9 @@ (-> 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,10 +229,10 @@ (-> 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]]} (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,10 +352,10 @@ [[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 + {.#None} (exception.except ..cannot_slice []))))) (def: .public (then structured text) diff --git a/stdlib/source/library/lux/control/parser/tree.lux b/stdlib/source/library/lux/control/parser/tree.lux index 68b4336a5..4d331c84f 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) @@ -37,11 +37,11 @@ (All (_ t) (Parser t [])) (function (_ zipper) (case (<direction> zipper) - #.None + {.#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 4e2414934..29fab0aa4 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} + {.#End} + {try.#Success output} _ (exception.except ..unconsumed_input remaining)))) @@ -92,47 +92,47 @@ (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) (.function (_ [env inputs]) (case inputs - #.End + {.#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) (.function (_ [env inputs]) (case inputs - #.End + {.#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,13 +146,13 @@ (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>] +(template [<name> <flattener> <exception>] [(`` (def: .public (<name> poly) (All (_ a) (-> (Parser a) (Parser a))) (do //.monad @@ -162,8 +162,8 @@ (local members poly) (//.failure (exception.error <exception> headT)))))))] - [variant type.flat_variant #.Sum ..not_variant] - [tuple type.flat_tuple #.Product ..not_tuple] + [variant type.flat_variant ..not_variant] + [tuple type.flat_tuple ..not_tuple] ) (def: polymorphic' @@ -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,12 +258,12 @@ [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 + {.#None} (//.failure (exception.error ..unknown_parameter headT))) _ @@ -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 6a1eb1206..71fb6fab9 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))) @@ -58,55 +58,55 @@ (Parser Text) (function (_ [attrs documents]) (case documents - #.End + {.#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 (Parser Tag) (function (_ [attrs documents]) (case documents - #.End + {.#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)) (function (_ [attrs documents]) (case (dictionary.value name attrs) - #.None + {.#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))) (function (_ [attrs documents]) (case documents - #.End + {.#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') @@ -117,11 +117,11 @@ (Parser XML) (function (_ [attrs documents]) (case documents - #.End + {.#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 + {.#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 2f9c81229..7ce13b79d 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/reader.lux b/stdlib/source/library/lux/control/reader.lux index e7c59e57b..09431e513 100644 --- a/stdlib/source/library/lux/control/reader.lux +++ b/stdlib/source/library/lux/control/reader.lux @@ -53,7 +53,7 @@ (All (_ M) (-> (Monad M) (All (_ e) (Monad (All (_ a) (Reader e (M a))))))) (def: &functor - (functor.composite ..functor (value@ #monad.&functor monad))) + (functor.composite ..functor (value@ monad.&functor monad))) (def: in (|>> (\ monad in) (\ ..monad in))) diff --git a/stdlib/source/library/lux/control/region.lux b/stdlib/source/library/lux/control/region.lux index 65b8e53e9..0082844a2 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)) + (\ monad in [{.#Item (function (_ region) (cleaner value)) cleaners} - {#try.Success value}]))) + {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) @@ -93,7 +93,7 @@ (All (_ r) (Apply (Region r !))))) (def: &functor - (..functor (value@ #monad.&functor super))) + (..functor (value@ monad.&functor super))) (def: (on fa ff) (function (_ [region cleaners]) @@ -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 (_ !) @@ -118,29 +118,29 @@ (All (_ r) (Monad (Region r !))))) (def: &functor - (..functor (value@ #monad.&functor super))) + (..functor (value@ monad.&functor super))) (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 dcf7c1c8b..b7047517d 100644 --- a/stdlib/source/library/lux/control/remember.lux +++ b/stdlib/source/library/lux/control/remember.lux @@ -30,10 +30,10 @@ ["Today" (%.date today)] ["Message" message] ["Code" (case focus - {#.Some focus} + {.#Some focus} (%.code focus) - #.None + {.#None} "")])) (def: deadline @@ -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,10 +57,10 @@ today (instant.date now)] (if (date\< deadline today) (in (case focus - {#.Some focus} + {.#Some focus} (list focus) - #.None + {.#None} (list))) (meta.failure (exception.error ..must_remember [deadline today message focus]))))) @@ -71,10 +71,10 @@ (in (list (` (..remember (~ (code.text (%.date deadline))) (~ (code.text (format <message> " " message))) (~+ (case focus - {#.Some focus} + {.#Some focus} (list focus) - #.None + {.#None} (list)))))))))] [to_do "TODO"] diff --git a/stdlib/source/library/lux/control/try.lux b/stdlib/source/library/lux/control/try.lux index b18a38dd8..eb078497f 100644 --- a/stdlib/source/library/lux/control/try.lux +++ b/stdlib/source/library/lux/control/try.lux @@ -64,7 +64,8 @@ (All (_ !) (-> (Monad !) (Monad (All (_ a) (! (Try a)))))) (def: &functor - (functor.composite (value@ #monad.&functor monad) ..functor)) + (functor.composite (value@ monad.&functor monad) + ..functor)) (def: in (|>> (\ ..monad in) @@ -114,19 +115,19 @@ (-> (Try a) (Maybe a))) (case try {#Success value} - {#.Some value} + {.#Some value} {#Failure message} - #.None)) + {.#None})) (def: .public (of_maybe maybe) (All (_ a) (-> (Maybe a) (Try a))) (case maybe - {#.Some value} + {.#Some value} {#Success value} - #.None + {.#None} {#Failure (`` (("lux in-module" (~~ (static .prelude_module)) .name\encoded) (name_of ..of_maybe)))})) @@ -134,10 +135,10 @@ (case tokens (^ (list else try)) {#Success [compiler (list (` (case (~ try) - {#..Success (~' g!temp)} + {..#Success (~' g!temp)} (~' g!temp) - {#..Failure (~ [location.dummy {#.Identifier ["" ""]}])} + {..#Failure (~ [location.dummy {.#Identifier ["" ""]}])} (~ else))))]} _ diff --git a/stdlib/source/library/lux/control/writer.lux b/stdlib/source/library/lux/control/writer.lux index bcf7e8d77..c30494e56 100644 --- a/stdlib/source/library/lux/control/writer.lux +++ b/stdlib/source/library/lux/control/writer.lux @@ -53,7 +53,7 @@ (All (_ l M) (-> (Monoid l) (Monad M) (Monad (All (_ a) (M (Writer l a)))))) (def: &functor - (functor.composite (value@ #monad.&functor monad) + (functor.composite (value@ monad.&functor monad) ..functor)) (def: in @@ -63,8 +63,8 @@ (def: (conjoint MlMla) (do monad [[l1 Mla] (for [@.old - (: {#.Apply (Writer (:parameter 0) - {#.Apply (Writer (:parameter 0) + (: {.#Apply (Writer (:parameter 0) + {.#Apply (Writer (:parameter 0) (:parameter 2)) (:parameter 1)}) (:parameter 1)} diff --git a/stdlib/source/library/lux/data/binary.lux b/stdlib/source/library/lux/data/binary.lux index e4a07b788..312f74be1 100644 --- a/stdlib/source/library/lux/data/binary.lux +++ b/stdlib/source/library/lux/data/binary.lux @@ -198,13 +198,13 @@ (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))} (exception.except ..index_out_of_bounds [(..!size binary) index]))) @@ -212,7 +212,7 @@ (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)) @@ -222,7 +222,7 @@ (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)) @@ -236,14 +236,14 @@ (def: .public (write/8! index value binary) (-> Nat (I64 Any) Binary (Try Binary)) (if (n.< (..!size binary) index) - {#try.Success (|> binary + {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))} (exception.except ..index_out_of_bounds [(..!size binary) index]))) @@ -251,7 +251,7 @@ (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)) @@ -269,8 +269,8 @@ (!write (n.+ 5 index) (i64.right_shifted 16 value)) (!write (n.+ 6 index) (i64.right_shifted 8 value)) (!write (n.+ 7 index) value))] - (|> binary write_high write_low #try.Success))] - {#try.Success (|> binary + (|> binary write_high write_low {try.#Success}))] + {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)) @@ -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 d78777213..831497deb 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 73cc3e9d0..08cfac991 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") @@ -78,8 +78,8 @@ (template: (!read! <read!> <null?>) [(let [output (<read!> index array)] (if (<null?> output) - #.None - {#.Some output}))]) + {.#None} + {.#Some output}))]) (def: .public (read! index array) (All (_ a) @@ -88,16 +88,16 @@ (for [@.old (let [value ("jvm aaload" array index)] (if ("jvm object null?" value) - #.None - {#.Some value})) + {.#None} + {.#Some value})) @.jvm (let [value (|> array (:as <array_type>) ("jvm array read object" (!int index)))] (if ("jvm object null?" value) - #.None - {#.Some (:expected value)})) + {.#None} + {.#Some (:expected value)})) @.js (!read! "js array read" "js object undefined?") @.python (!read! "python array read" "python object none?") @@ -105,7 +105,7 @@ @.ruby (!read! "ruby array read" "ruby object nil?") @.php (!read! "php array read" "php object null?") @.scheme (!read! "scheme array read" "scheme object nil?")]) - #.None)) + {.#None})) (def: .public (write! index value array) (All (_ a) @@ -149,7 +149,7 @@ (All (_ a) (-> Nat (Array a) Bit)) (case (..read! index array) - {#.Some _} + {.#Some _} true _ @@ -159,10 +159,10 @@ (All (_ a) (-> Nat (-> a a) (Array a) (Array a))) (case (read! index array) - #.None + {.#None} array - {#.Some value} + {.#Some value} (write! index (transform value) array))) (def: .public (upsert! index default transform array) @@ -180,10 +180,10 @@ dest_array (list\mix (function (_ offset target) (case (read! (n.+ offset src_start) src_array) - #.None + {.#None} target - {#.Some value} + {.#Some value} (write! (n.+ offset dest_start) value target))) dest_array (list.indices length)))) @@ -192,10 +192,10 @@ (All (_ a) (-> (Array a) Nat)) (list\mix (function (_ idx count) (case (read! idx array) - #.None + {.#None} count - {#.Some _} + {.#Some _} (++ count))) 0 (list.indices (size array)))) @@ -209,10 +209,10 @@ (-> (Predicate a) (Array a) (Array a))) (list\mix (function (_ idx xs') (case (read! idx xs) - #.None + {.#None} xs' - {#.Some x} + {.#Some x} (if (p x) xs' (delete! idx xs')))) @@ -226,14 +226,14 @@ (loop [idx 0] (if (n.< arr_size idx) (case (read! idx xs) - #.None + {.#None} (recur (++ idx)) - {#.Some x} + {.#Some x} (if (p x) - {#.Some x} + {.#Some x} (recur (++ idx)))) - #.None)))) + {.#None})))) (def: .public (example+ p xs) (All (_ a) @@ -242,24 +242,24 @@ (loop [idx 0] (if (n.< arr_size idx) (case (read! idx xs) - #.None + {.#None} (recur (++ idx)) - {#.Some x} + {.#Some x} (if (p idx x) - {#.Some [idx x]} + {.#Some [idx x]} (recur (++ idx)))) - #.None)))) + {.#None})))) (def: .public (clone xs) (All (_ a) (-> (Array a) (Array a))) (let [arr_size (size xs)] (list\mix (function (_ idx ys) (case (read! idx xs) - #.None + {.#None} ys - {#.Some x} + {.#Some x} (write! idx x ys))) (empty arr_size) (list.indices arr_size)))) @@ -278,7 +278,7 @@ (def: (list|-default array) (All (_ a) (-> (Array a) (List a))) (loop [idx (-- (size array)) - output #.End] + output {.#End}] (case idx (^ (static ..underflow)) output @@ -286,32 +286,32 @@ _ (recur (-- idx) (case (read! idx array) - {#.Some head} - {#.Item head output} + {.#Some head} + {.#Item head output} - #.None + {.#None} output))))) (def: (list|+default default array) (All (_ a) (-> a (Array a) (List a))) (loop [idx (-- (size array)) - output #.End] + output {.#End}] (case idx (^ (static ..underflow)) output _ (recur (-- idx) - {#.Item (maybe.else default (read! idx array)) + {.#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 + {.#None} (list|-default array))) (implementation: .public (equivalence (^open ",\[0]")) @@ -324,10 +324,10 @@ (list\mix (function (_ idx prev) (and prev (case [(read! idx xs) (read! idx ys)] - [#.None #.None] + [{.#None} {.#None}] true - [{#.Some x} {#.Some y}] + [{.#Some x} {.#Some y}] (,\= x y) _ @@ -356,10 +356,10 @@ (empty arr_size) (list\mix (function (_ idx mb) (case (read! idx ma) - #.None + {.#None} mb - {#.Some x} + {.#Some x} (write! idx (f x) mb))) (empty arr_size) (list.indices arr_size)) @@ -374,10 +374,10 @@ idx 0] (if (n.< arr_size idx) (case (read! idx xs) - #.None + {.#None} (recur so_far (++ idx)) - {#.Some value} + {.#Some value} (recur (f value so_far) (++ idx))) so_far))))) @@ -390,11 +390,11 @@ (loop [idx 0] (if (n.< size idx) (case (..read! idx array) - {#.Some value} + {.#Some value} (<op> (predicate value) (recur (++ idx))) - #.None + {.#None} (recur (++ idx))) <init>)))))] diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux index 0b9690eb3..bdfc2638a 100644 --- a/stdlib/source/library/lux/data/collection/dictionary.lux +++ b/stdlib/source/library/lux/data/collection/dictionary.lux @@ -240,12 +240,12 @@ (product.right (list\mix (function (_ idx [insertion_idx node]) (let [[bitmap base] node] (case (array.read! idx h_array) - #.None [insertion_idx node] - {#.Some sub_node} (if (n.= except_idx idx) + {.#None} [insertion_idx node] + {.#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,15 +268,15 @@ 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) - #.None + {.#None} (undefined))] default)) [0 @@ -303,7 +303,7 @@ {#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] _ @@ -321,18 +321,18 @@ (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')] + {.#Left (let [hash' (\ key_hash hash key')] (if (n.= hash hash') ... If the hashes are ... the same, a new @@ -352,7 +352,7 @@ (node\has next_level hash key val key_hash)))))} base)}) - #.None + {.#None} (undefined))) ... However, if the Bit_Position has not been used yet, check ... whether this #Base node is ready for a promotion. @@ -361,7 +361,7 @@ ... 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)} + (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) @@ -378,17 +378,17 @@ (case (collision_index key_hash key _colls) ... If the key was already present in the collisions-list, its ... value gets updated. - {#.Some coll_idx} + {.#Some coll_idx} {#Collisions _hash (array\revised coll_idx [key val] _colls)} ... Otherwise, the KV-pair is added to the collisions-list. - #.None + {.#None} {#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}))} + (array.write! 0 {.#Left node}))} (node\has level hash key val key_hash))) )) @@ -401,11 +401,11 @@ (let [idx (level_index level hash)] (case (array.read! idx h_array) ... If not, there's nothing to remove. - #.None + {.#None} 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') @@ -431,7 +431,7 @@ (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') @@ -450,10 +450,10 @@ ... 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)}))) + (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. @@ -462,7 +462,7 @@ ... Otherwise, there's nothing to remove. node) - #.None + {.#None} (undefined))) ... If the Bit_Position is not set, there's nothing to remove. node)) @@ -471,11 +471,11 @@ {#Collisions _hash _colls} (case (collision_index key_hash key _colls) ... If not, then there's nothing to remove. - #.None + {.#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. @@ -490,25 +490,25 @@ ... For #Hierarchy nodes, just look-up the key on its children. {#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)) + {.#None} {.#None} + {.#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} (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'} - #.None) + {.#Some val'} + {.#None}) - #.None + {.#None} (undefined)) - #.None)) + {.#None})) ... For #Collisions nodes, do a linear scan of all the known KV-pairs. {#Collisions _hash _colls} @@ -526,8 +526,8 @@ {#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} @@ -539,23 +539,23 @@ (case node {#Hierarchy _size hierarchy} (array\mix (function (_ sub_node tail) (list\composite (node\entries sub_node) tail)) - #.End + {.#End} hierarchy) {#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})) - #.End + {.#Right [key' val']} + {.#Item [key' val'] tail})) + {.#End} base) {#Collisions hash colls} - (array\mix (function (_ [key' val'] tail) {#.Item [key' val'] tail}) - #.End + (array\mix (function (_ [key' val'] tail) {.#Item [key' val'] tail}) + {.#End} colls))) (type: .public (Dictionary k v) @@ -565,7 +565,7 @@ (def: .public key_hash (All (_ k v) (-> (Dictionary k v) (Hash k))) - (value@ #..hash)) + (value@ ..#hash)) (def: .public (empty key_hash) (All (_ k v) (-> (Hash k) (Dictionary k v))) @@ -590,24 +590,24 @@ (def: .public (key? dict key) (All (_ k v) (-> (Dictionary k v) k Bit)) (case (value key dict) - #.None #0 - {#.Some _} #1)) + {.#None} #0 + {.#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))) (case (value key dict) - #.None + {.#None} dict - {#.Some val} + {.#Some val} (has key (f val) dict))) (def: .public (revised' key default f dict) @@ -641,8 +641,8 @@ (All (_ k v) (-> (Dictionary k v) (List <side>))) (|>> ..entries (list\mix (function (_ [k v] bundle) - {#.Item <side> bundle}) - #.End)))] + {.#Item <side> bundle}) + {.#End})))] [k keys] [v values] @@ -658,10 +658,10 @@ (All (_ k v) (-> (-> v v v) (Dictionary k v) (Dictionary k v) (Dictionary k v))) (list\mix (function (_ [key val2] dict) (case (value key dict) - #.None + {.#None} (has key val2 dict) - {#.Some val1} + {.#Some val1} (has key (f val2 val1) dict))) dict1 (entries dict2))) @@ -669,10 +669,10 @@ (def: .public (re_bound from_key to_key dict) (All (_ k v) (-> k k (Dictionary k v) (Dictionary k v))) (case (value from_key dict) - #.None + {.#None} dict - {#.Some val} + {.#Some val} (|> dict (lacks from_key) (has to_key val)))) @@ -682,8 +682,8 @@ (let [[key_hash _] dict] (list\mix (function (_ key new_dict) (case (value key dict) - #.None new_dict - {#.Some val} (has key val new_dict))) + {.#None} 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) _ @@ -713,11 +713,11 @@ {#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)]})) + {.#Right [k v]} + {.#Right [k (f v)]})) base)} {#Collisions hash collisions} diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux index d6376e88b..1fc2e3ea5 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux @@ -20,8 +20,8 @@ (type: Color (Variant - #Red - #Black)) + {#Red} + {#Black})) (type: (Node k v) (Record @@ -34,7 +34,7 @@ (template [<create> <color>] [(def: (<create> key value left right) (All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) - [#color <color> + [#color {<color>} #key key #value value #left left @@ -52,7 +52,7 @@ (def: .public (empty order) (All (_ k v) (-> (Order k) (Dictionary k v))) [#&order order - #root #.None]) + #root {.#None}]) ... TODO: Doing inneficient access of Order functions due to compiler bug. ... TODO: Must improve it as soon as bug is fixed. @@ -62,14 +62,14 @@ ] (loop [node (value@ #root dict)] (case node - #.None - #.None + {.#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) @@ -87,10 +87,10 @@ ] (loop [node (value@ #root dict)] (case node - #.None + {.#None} #0 - {#.Some node} + {.#Some node} (let [node_key (value@ #key node)] (or (\ dict = node_key key) ... (_\= node_key key) @@ -103,16 +103,16 @@ [(def: .public (<name> dict) (All (_ k v) (-> (Dictionary k v) (Maybe v))) (case (value@ #root dict) - #.None - #.None + {.#None} + {.#None} - {#.Some node} + {.#Some node} (loop [node node] (case (value@ <side> node) - #.None - {#.Some (value@ #value node)} + {.#None} + {.#Some (value@ #value node)} - {#.Some side} + {.#Some side} (recur side)))))] [min #left] @@ -123,10 +123,10 @@ (All (_ k v) (-> (Dictionary k v) Nat)) (loop [node (value@ #root dict)] (case node - #.None + {.#None} 0 - {#.Some node} + {.#Some node} (++ (n.+ (recur (value@ #left node)) (recur (value@ #right node))))))) @@ -138,10 +138,10 @@ [(def: (<name> self) (All (_ k v) (-> (Node k v) (Node k v))) (case (value@ #color self) - <other_color> - (with@ #color <self_color> self) + {<other_color>} + (with@ #color {<self_color>} self) - <self_color> + {<self_color>} <no_change> ))] @@ -152,42 +152,42 @@ (def: (with_left addition center) (All (_ k v) (-> (Node k v) (Node k v) (Node k v))) (case (value@ #color center) - #Red + {#Red} (red (value@ #key center) (value@ #value center) - {#.Some addition} + {.#Some addition} (value@ #right center)) - #Black + {#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 + {#Red} (case (value@ #left addition) - (^multi {#.Some left} - [(value@ #color left) #Red]) + (^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))}) _ (case (value@ #right addition) - (^multi {#.Some right} - [(value@ #color right) #Red]) + (^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) + {.#Some (black (value@ #key center) (value@ #value center) (value@ #right right) (value@ #right center))}) @@ -195,48 +195,48 @@ _ <default_behavior>)) - #Black + {#Black} <default_behavior>)))) (def: (with_right addition center) (All (_ k v) (-> (Node k v) (Node k v) (Node k v))) (case (value@ #color center) - #Red + {#Red} (red (value@ #key center) (value@ #value center) (value@ #left center) - {#.Some addition}) + {.#Some addition}) - #Black + {#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 + {#Red} (case (value@ #right addition) - (^multi {#.Some right} - [(value@ #color right) #Red]) + (^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)}) + {.#Some (blackened right)}) _ (case (value@ #left addition) - (^multi {#.Some left} - [(value@ #color left) #Red]) + (^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) + {.#Some (black (value@ #key addition) (value@ #value addition) (value@ #right left) (value@ #right addition))}) @@ -244,7 +244,7 @@ _ <default_behavior>)) - #Black + {#Black} <default_behavior>)))) (def: .public (has key value dict) @@ -252,10 +252,10 @@ (let [(^open "_\[0]") (value@ #&order dict) root' (loop [?root (value@ #root dict)] (case ?root - #.None - {#.Some (red key value #.None #.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) + {.#Some (<add> (maybe.trusted outcome) root)}))] - [_\< #left ..with_left] + [_\< #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,26 +279,26 @@ (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} - [(value@ #color left) #Red] - [(value@ #left left) {#.Some left>>left}] - [(value@ #color left>>left) #Red]) + (^multi {.#Some left} + [(value@ #color left) {#Red}] + [(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} - [(value@ #color left) #Red] - [(value@ #right left) {#.Some left>>right}] - [(value@ #color left>>right) #Red]) + (^multi {.#Some left} + [(value@ #color left) {#Red}] + [(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 + {.#Some (black key value (value@ #right left>>right) ?right)}) @@ -308,23 +308,23 @@ (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} - [(value@ #color right) #Red] - [(value@ #right right) {#.Some right>>right}] - [(value@ #color right>>right) #Red]) + (^multi {.#Some right} + [(value@ #color right) {#Red}] + [(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} - [(value@ #color right) #Red] - [(value@ #left right) {#.Some right>>left}] - [(value@ #color right>>left) #Red]) + (^multi {.#Some right} + [(value@ #color right) {#Red}] + [(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))}) @@ -335,24 +335,24 @@ (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} - [(value@ #color left) #Red]) - (red key value {#.Some (blackened left)} ?right) + (^multi {.#Some left} + [(value@ #color left) {#Red}]) + (red key value {.#Some (blackened left)} ?right) _ (case ?right - (^multi {#.Some right} - [(value@ #color right) #Black]) - (right_balanced key value ?left {#.Some (reddened right)}) - - (^multi {#.Some right} - [(value@ #color right) #Red] - [(value@ #left right) {#.Some right>>left}] - [(value@ #color right>>left) #Black]) + (^multi {.#Some right} + [(value@ #color right) {#Black}]) + (right_balanced key value ?left {.#Some (reddened right)}) + + (^multi {.#Some right} + [(value@ #color right) {#Red}] + [(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)))}) @@ -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} - [(value@ #color right) #Red]) - (red key value ?left {#.Some (blackened right)}) + (^multi {.#Some right} + [(value@ #color right) {#Red}]) + (red key value ?left {.#Some (blackened right)}) _ (case ?left - (^multi {#.Some left} - [(value@ #color left) #Black]) - (left_balanced key value {#.Some (reddened left)} ?right) - - (^multi {#.Some left} - [(value@ #color left) #Red] - [(value@ #right left) {#.Some left>>right}] - [(value@ #color left>>right) #Black]) + (^multi {.#Some left} + [(value@ #color left) {#Black}]) + (left_balanced key value {.#Some (reddened left)} ?right) + + (^multi {.#Some left} + [(value@ #color left) {#Red}] + [(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)}) + {.#Some (black key value (value@ #right left>>right) ?right)}) _ (panic! error_message) @@ -393,76 +393,76 @@ (def: (prepended ?left ?right) (All (_ k v) (-> (Maybe (Node k v)) (Maybe (Node k v)) (Maybe (Node k v)))) (case [?left ?right] - [#.None _] + [{.#None} _] ?right - [_ #.None] + [_ {.#None}] ?left - [{#.Some left} {#.Some right}] + [{.#Some left} {.#Some right}] (case [(value@ #color left) (value@ #color right)] - [#Red #Red] + [{#Red} {#Red}] (do maybe.monad [fused (prepended (value@ #right left) (value@ #right right))] (case (value@ #color fused) - #Red + {#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) + {.#Some (red (value@ #key right) (value@ #value right) (value@ #right fused) (value@ #right right))})) - #Black + {#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} + {.#Some fused} (value@ #right right))})))) - [#Red #Black] - {#.Some (red (value@ #key left) + [{#Red} {#Black}] + {.#Some (red (value@ #key left) (value@ #value left) (value@ #left left) (prepended (value@ #right left) ?right))} - [#Black #Red] - {#.Some (red (value@ #key right) + [{#Black} {#Red}] + {.#Some (red (value@ #key right) (value@ #value right) (prepended ?left (value@ #left right)) (value@ #right right))} - [#Black #Black] + [{#Black} {#Black}] (do maybe.monad [fused (prepended (value@ #right left) (value@ #left right))] (case (value@ #color fused) - #Red + {#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) + {.#Some (black (value@ #key right) (value@ #value right) (value@ #right fused) (value@ #right right))})) - #Black + {#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} + {.#Some fused} (value@ #right right))})) )) ) @@ -475,10 +475,10 @@ (let [(^open "_\[0]") (value@ #&order dict) [?root found?] (loop [?root (value@ #root dict)] (case ?root - #.None - [#.None #0] + {.#None} + [{.#None} #0] - {#.Some root} + {.#Some root} (let [root_key (value@ #key root) root_val (value@ #value root)] (if (_\= root_key key) @@ -489,49 +489,49 @@ (case (recur (if go_left? (value@ #left root) (value@ #right root))) - [#.None #0] - [#.None #0] + [{.#None} #0] + [{.#None} #0] [side_outcome _] (if go_left? (case (value@ #left root) - (^multi {#.Some left} - [(value@ #color left) #Black]) - [{#.Some (without_left root_key root_val side_outcome (value@ #right root))} + (^multi {.#Some left} + [(value@ #color left) {#Black}]) + [{.#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} - [(value@ #color right) #Black]) - [{#.Some (without_right root_key root_val (value@ #left root) side_outcome)} + (^multi {.#Some right} + [(value@ #color right) {#Black}]) + [{.#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]) ))) )) ))] (case ?root - #.None + {.#None} (if found? (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 + {.#None} dict)) (def: .public (of_list order list) @@ -546,10 +546,10 @@ (All (_ k v) (-> (Dictionary k v) (List <type>))) (loop [node (value@ #root dict)] (case node - #.None + {.#None} (list) - {#.Some node'} + {.#Some node'} ($_ list\composite (recur (value@ #left node')) (list <output>) @@ -568,10 +568,10 @@ (loop [entriesR (entries reference) entriesS (entries sample)] (case [entriesR entriesS] - [#.End #.End] + [{.#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 bb7f63265..8ffa6682a 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/plist.lux @@ -18,7 +18,7 @@ (def: .public empty PList - #.End) + {.#End}) (def: .public size (All (_ a) (-> (PList a) Nat)) @@ -31,12 +31,12 @@ (def: .public (value key properties) (All (_ a) (-> Text (PList a) (Maybe a))) (case properties - #.End - #.None + {.#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,46 +51,46 @@ (def: .public (contains? key properties) (All (_ a) (-> Text (PList a) Bit)) (case (..value key properties) - {#.Some _} + {.#Some _} true - #.None + {.#None} false)) (def: .public (has key val properties) (All (_ a) (-> Text a (PList a) (PList a))) (case properties - #.End + {.#End} (list [key val]) - {#.Item [k' v'] properties'} + {.#Item [k' v'] properties'} (if (text\= key k') - {#.Item [key val] + {.#Item [key val] properties'} - {#.Item [k' v'] + {.#Item [k' v'] (has key val properties')}))) (def: .public (revised key f properties) (All (_ a) (-> Text (-> a a) (PList a) (PList a))) (case properties - #.End - #.End + {.#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))) (case properties - #.End + {.#End} properties - {#.Item [k' v'] properties'} + {.#Item [k' v'] properties'} (if (text\= key k') properties' - {#.Item [k' v'] + {.#Item [k' v'] (lacks key properties')}))) (def: .public equivalence diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux index e2cb06a42..4232af895 100644 --- a/stdlib/source/library/lux/data/collection/list.lux +++ b/stdlib/source/library/lux/data/collection/list.lux @@ -28,60 +28,61 @@ (def: (mix f init xs) (case xs - #.End + {.#End} init - {#.Item x xs'} + {.#Item x xs'} (mix f (f x init) xs')))) (def: .public (mixes f init inputs) (All (_ a b) (-> (-> a b b) b (List a) (List b))) (case inputs - #.End + {.#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}) - #.End + (mix (function (_ head tail) + {.#Item head tail}) + {.#End} xs)) (def: .public (only keep? xs) (All (_ a) (-> (Predicate a) (List a) (List a))) (case xs - #.End - #.End + {.#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) (All (_ a) (-> (Predicate a) (List a) [(List a) (List a)])) (case list - #.End - [#.End #.End] + {.#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)) + {.#End})) (template [<name> <then> <else>] [(def: .public (<name> n xs) @@ -89,14 +90,14 @@ (-> Nat (List a) (List a))) (if (n.> 0 n) (case xs - #.End - #.End + {.#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] ) @@ -105,15 +106,15 @@ (All (_ a) (-> (Predicate a) (List a) (List a))) (case xs - #.End - #.End + {.#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] ) @@ -122,82 +123,82 @@ (-> Nat (List a) [(List a) (List a)])) (if (n.> 0 n) (case xs - #.End - [#.End #.End] + {.#End} + [{.#End} {.#End}] - {#.Item x xs'} + {.#Item x xs'} (let [[tail rest] (split_at (-- n) xs')] - [{#.Item x tail} rest])) - [#.End xs])) + [{.#Item x tail} rest])) + [{.#End} xs])) (def: (split_when' predicate ys xs) (All (_ a) (-> (Predicate a) (List a) (List a) [(List a) (List a)])) (case xs - #.End + {.#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) (-> (Predicate a) (List a) [(List a) (List a)])) - (let [[ys' xs'] (split_when' predicate #.End xs)] + (let [[ys' xs'] (split_when' predicate {.#End} xs)] [(reversed ys') xs'])) (def: .public (sub size list) (All (_ a) (-> Nat (List a) (List (List a)))) (case list - #.End - #.End + {.#End} + {.#End} _ (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)})) + 0 {.#End} + _ {.#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 + {.#None} (list))) (def: .public (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 + {.#None} (list x))) (def: .public (one check xs) (All (_ a b) (-> (-> a (Maybe b)) (List a) (Maybe b))) (case xs - #.End - #.None + {.#End} + {.#None} - {#.Item x xs'} + {.#Item x xs'} (case (check x) - {#.Some output} - {#.Some output} + {.#Some output} + {.#Some output} - #.None + {.#None} (one check xs')))) (def: .public (all check xs) @@ -207,23 +208,23 @@ @.js (mix (function (_ head tail) (case (check head) - {#.Some head} - {#.Item head tail} + {.#Some head} + {.#Item head tail} - #.None + {.#None} tail)) - #.End + {.#End} (reversed xs))] (case xs - #.End - #.End + {.#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 + {.#None} (all check xs'))))) (def: .public (example predicate xs) @@ -231,21 +232,21 @@ (-> (Predicate a) (List a) (Maybe a))) (..one (function (_ value) (if (predicate value) - {#.Some value} - #.None)) + {.#Some value} + {.#None})) xs)) (def: .public (interposed sep xs) (All (_ a) (-> a (List a) (List a))) (case xs - #.End + {.#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) @@ -257,10 +258,10 @@ (All (_ a) (-> (Predicate a) (List a) Bit)) (case items - #.End + {.#End} <init> - {#.Item head tail} + {.#Item head tail} (<op> (predicate head) (<name> predicate tail))))] @@ -272,12 +273,12 @@ (All (_ a) (-> Nat (List a) (Maybe a))) (case xs - #.End - #.None + {.#End} + {.#None} - {#.Item x xs'} + {.#Item x xs'} (case i - 0 {#.Some x} + 0 {.#Some x} _ (item (-- i) xs')))) (implementation: .public (equivalence Equivalence<a>) @@ -285,10 +286,10 @@ (def: (= xs ys) (case [xs ys] - [#.End #.End] + [{.#End} {.#End}] #1 - [{#.Item x xs'} {#.Item y ys'}] + [{.#Item x xs'} {.#Item y ys'}] (and (\ Equivalence<a> = x y) (= xs' ys')) @@ -311,14 +312,15 @@ (implementation: .public monoid (All (_ a) (Monoid (List a))) - (def: identity #.End) + (def: identity + {.#End}) (def: (composite xs ys) (case xs - #.End + {.#End} ys - {#.Item x xs'} - {#.Item x (composite xs' ys)}))) + {.#Item x xs'} + {.#Item x (composite xs' ys)}))) (open: "[0]" ..monoid) @@ -327,11 +329,11 @@ (def: (each f ma) (case ma - #.End - #.End + {.#End} + {.#End} - {#.Item a ma'} - {#.Item (f a) (each f ma')}))) + {.#Item a ma'} + {.#Item (f a) (each f ma')}))) (open: "[0]" ..functor) @@ -342,10 +344,10 @@ (def: (on fa ff) (case ff - #.End - #.End + {.#End} + {.#End} - {#.Item f ff'} + {.#Item f ff'} (|> ff' (on fa) (composite (each f fa)))))) @@ -356,7 +358,7 @@ (def: &functor ..functor) (def: (in a) - {#.Item a #.End}) + {.#Item a {.#End}}) (def: conjoint (|>> reversed (mix composite identity)))) @@ -364,14 +366,14 @@ (def: .public (sorted < xs) (All (_ a) (-> (-> a a Bit) (List a) (List a))) (case xs - #.End + {.#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))))) @@ -379,7 +381,7 @@ (def: .public (empty? xs) (All (_ a) (Predicate (List a))) (case xs - #.End + {.#End} true _ @@ -388,10 +390,10 @@ (def: .public (member? eq xs x) (All (_ a) (-> (Equivalence a) (List a) a Bit)) (case xs - #.End + {.#End} #0 - {#.Item x' xs'} + {.#Item x' xs'} (or (\ eq = x x') (member? eq xs' x)))) @@ -399,11 +401,11 @@ [(def: .public (<name> xs) (All (_ a) (-> (List a) (Maybe <output>))) (case xs - #.End - #.None + {.#End} + {.#None} - {#.Item x xs'} - {#.Some <side>}))] + {.#Item x xs'} + {.#Some <side>}))] [head a x] [tail (List a) xs'] @@ -417,7 +419,7 @@ (def: (identifier$ name) (-> Text Code) - [["" 0 0] {#.Identifier "" name}]) + [["" 0 0] {.#Identifier "" name}]) (def: (nat\encoded value) (-> Nat Text) @@ -443,7 +445,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 +460,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 +469,23 @@ (function ((~ g!step) (~+ list_vars)) (case [(~+ list_vars)] (~ pattern) - {#.Item [(~+ (each product.left vars+lists))] + {.#Item [(~+ (each product.left vars+lists))] ((~ g!step) (~+ list_vars))} (~ g!blank) - #.End))))] - {#.Right [state (list code)]}) - {#.Left "Cannot zipped 0 lists."}) + {.#End}))))] + {.#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 +503,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 +512,16 @@ (function ((~ g!step) (~ g!func) (~+ list_vars)) (case [(~+ list_vars)] (~ pattern) - {#.Item ((~ g!func) (~+ (each product.left vars+lists))) + {.#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."}) + {.#End}))))] + {.#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)) @@ -527,31 +529,31 @@ (def: .public (last xs) (All (_ a) (-> (List a) (Maybe a))) (case xs - #.End - #.None + {.#End} + {.#None} - {#.Item x #.End} - {#.Some x} + {.#Item x {.#End}} + {.#Some x} - {#.Item x xs'} + {.#Item x xs'} (last xs'))) (def: .public (inits xs) (All (_ a) (-> (List a) (Maybe (List a)))) (case xs - #.End - #.None + {.#End} + {.#None} - {#.Item x #.End} - {#.Some #.End} + {.#Item x {.#End}} + {.#Some {.#End}} - {#.Item x xs'} + {.#Item x xs'} (case (inits xs') - #.None + {.#None} (undefined) - {#.Some tail} - {#.Some {#.Item x tail}}) + {.#Some tail} + {.#Some {.#Item x tail}}) )) (def: .public together @@ -562,7 +564,7 @@ (All (_ M) (-> (Monad M) (Monad (All (_ a) (M (List a)))))) (def: &functor - (functor.composite (value@ #monad.&functor monad) + (functor.composite (value@ monad.&functor monad) ..functor)) (def: in @@ -573,9 +575,8 @@ [lMla MlMla ... TODO: Remove this version ASAP and use one below. lla (for [@.old - (: {#.Apply - (type (List (List (:parameter 1)))) - (:parameter 0)} + (: {.#Apply (type (List (List (:parameter 1)))) + (:parameter 0)} (monad.all ! lMla))] (monad.all ! lMla))] (in (..together lla))))) @@ -589,18 +590,18 @@ (loop [idx 0 xs xs] (case xs - #.End - #.End + {.#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))))]} _ - {#.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 7a52a1e9f..4fc1e31a1 100644 --- a/stdlib/source/library/lux/data/collection/queue.lux +++ b/stdlib/source/library/lux/data/collection/queue.lux @@ -29,7 +29,7 @@ (def: .public (list queue) (All (_ a) (-> (Queue a) (List a))) (let [(^slots [#front #rear]) queue] - (list\composite front (list.reversed rear)))) + (list\composite #front (list.reversed #rear)))) (def: .public front (All (_ a) (-> (Queue a) (Maybe a))) @@ -38,8 +38,8 @@ (def: .public (size queue) (All (_ a) (-> (Queue a) Nat)) (let [(^slots [#front #rear]) queue] - (n.+ (list.size front) - (list.size rear)))) + (n.+ (list.size #front) + (list.size #rear)))) (def: .public empty? (All (_ a) (-> (Queue a) Bit)) @@ -48,8 +48,8 @@ (def: .public (member? equivalence queue member) (All (_ a) (-> (Equivalence a) (Queue a) a Bit)) (let [(^slots [#front #rear]) queue] - (or (list.member? equivalence front member) - (list.member? equivalence rear member)))) + (or (list.member? equivalence #front member) + (list.member? equivalence #rear member)))) (def: .public (next queue) (All (_ a) (-> (Queue a) (Queue a))) @@ -72,11 +72,11 @@ (def: .public (end val queue) (All (_ a) (-> a (Queue a) (Queue a))) (case (value@ #front queue) - #.End + {.#End} (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 d277ec515..e9069fa5e 100644 --- a/stdlib/source/library/lux/data/collection/queue/priority.lux +++ b/stdlib/source/library/lux/data/collection/queue/priority.lux @@ -42,7 +42,7 @@ (def: .public empty Queue - (:abstraction #.None)) + (:abstraction {.#None})) (def: .public (front queue) (All (_ a) (-> (Queue a) (Maybe a))) @@ -54,10 +54,10 @@ (def: .public (size queue) (All (_ a) (-> (Queue a) Nat)) (case (:representation queue) - #.None + {.#None} 0 - {#.Some tree} + {.#Some tree} (loop [node tree] (case (tree.root node) {0 #0 _} @@ -69,10 +69,10 @@ (def: .public (member? equivalence queue member) (All (_ a) (-> (Equivalence a) (Queue a) a Bit)) (case (:representation queue) - #.None + {.#None} false - {#.Some tree} + {.#Some tree} (loop [node tree] (case (tree.root node) {0 #0 reference} @@ -92,34 +92,34 @@ (case (tree.root node) {0 #0 reference} (if (n.= highest_priority (tree.tag node)) - #.None - {#.Some node}) + {.#None} + {.#Some node}) {0 #1 left right} (if (n.= highest_priority (tree.tag left)) (case (recur left) - #.None - {#.Some right} + {.#None} + {.#Some right} - {#.Some =left} - {#.Some (\ ..builder branch =left right)}) + {.#Some =left} + {.#Some (\ ..builder branch =left right)}) (case (recur right) - #.None - {#.Some left} + {.#None} + {.#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))) (let [addition (\ ..builder leaf priority value)] (:abstraction (case (:representation queue) - #.None - {#.Some addition} + {.#None} + {.#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 aa8c6d0f7..a39ea8af3 100644 --- a/stdlib/source/library/lux/data/collection/row.lux +++ b/stdlib/source/library/lux/data/collection/row.lux @@ -96,7 +96,7 @@ {#Base tail} (|> (empty_hierarchy []) (array.write! 0 (path (level_down level) tail)) - #Hierarchy))) + {#Hierarchy}))) (def: (tail singleton) (All (_ a) (-> a (Base a))) @@ -113,10 +113,10 @@ ... Otherwise, check whether there's a vacant spot (case (array.read! sub_idx parent) ... If so, set the path to the tail - #.None + {.#None} (..path (level_down level) tail) ... If not, push the tail onto the sub_node. - {#.Some {#Hierarchy sub_node}} + {.#Some {#Hierarchy sub_node}} {#Hierarchy (with_tail size (level_down level) tail sub_node)} _ @@ -136,16 +136,16 @@ (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)})) - (^multi {#.Some {#Base base}} + (^multi {.#Some {#Base base}} (n.= 0 (level_down level))) (|> (array.clone hierarchy) (array.write! sub_idx (|> (array.clone base) (array.write! (branch_idx idx) val) - #Base))) + {#Base}))) _ (undefined)))) @@ -154,7 +154,7 @@ (All (_ a) (-> Nat Level (Hierarchy a) (Maybe (Hierarchy a)))) (let [sub_idx (branch_idx (i64.right_shifted level (n.- 2 size)))] (cond (n.= 0 sub_idx) - #.None + {.#None} (n.> branching_exponent level) (do maybe.monad @@ -167,27 +167,27 @@ (undefined))] (|> (array.clone hierarchy) (array.write! sub_idx {#Hierarchy sub}) - #.Some)) + {.#Some})) ... Else... (|> (array.clone hierarchy) (array.delete! sub_idx) - #.Some) + {.#Some}) ))) (def: (node\list node) (All (_ a) (-> (Node a) (List a))) (case node {#Base base} - (array.list #.None base) + (array.list {.#None} base) {#Hierarchy hierarchy} (|> hierarchy - (array.list #.None) + (array.list {.#None}) list.reversed (list\mix (function (_ sub acc) (list\composite (node\list sub) acc)) - #.End)))) + {.#End})))) (type: .public (Row a) (Record @@ -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] + [_ {.#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,17 +280,17 @@ (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 + {.#None} (exception.except ..incorrect_row_structure [])))) (def: .public (has idx val row) (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 @@ -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) _ @@ -492,8 +492,8 @@ (<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 6e4e0b801..fccc576df 100644 --- a/stdlib/source/library/lux/data/collection/sequence.lux +++ b/stdlib/source/library/lux/data/collection/sequence.lux @@ -39,10 +39,10 @@ (loop [head start tail next] (//.pending [head (case tail - #.End + {.#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 2d4c3975b..b325c793a 100644 --- a/stdlib/source/library/lux/data/collection/set/multi.lux +++ b/stdlib/source/library/lux/data/collection/set/multi.lux @@ -43,13 +43,13 @@ (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)) (dictionary.lacks elem (:representation set)))) - #.None + {.#None} set))) (def: .public (multiplicity set elem) @@ -62,7 +62,7 @@ dictionary.entries (list\mix (function (_ [elem multiplicity] output) (list\composite (list.repeated multiplicity elem) output)) - #.End))) + {.#End}))) (template [<name> <composite>] [(def: .public (<name> parameter subject) diff --git a/stdlib/source/library/lux/data/collection/set/ordered.lux b/stdlib/source/library/lux/data/collection/set/ordered.lux index 72344d090..2fea2876a 100644 --- a/stdlib/source/library/lux/data/collection/set/ordered.lux +++ b/stdlib/source/library/lux/data/collection/set/ordered.lux @@ -58,13 +58,13 @@ (All (_ a) (-> (Set a) (Set a) (Set a))) (|> (..list right) (list.only (..member? left)) - (..of_list (value@ #/.&order (:representation right))))) + (..of_list (value@ /.#&order (:representation right))))) (def: .public (difference param subject) (All (_ a) (-> (Set a) (Set a) (Set a))) (|> (..list subject) (list.only (|>> (..member? param) not)) - (..of_list (value@ #/.&order (:representation subject))))) + (..of_list (value@ /.#&order (:representation subject))))) (implementation: .public equivalence (All (_ a) (Equivalence (Set a))) diff --git a/stdlib/source/library/lux/data/collection/stack.lux b/stdlib/source/library/lux/data/collection/stack.lux index e90d53f84..8c55178f9 100644 --- a/stdlib/source/library/lux/data/collection/stack.lux +++ b/stdlib/source/library/lux/data/collection/stack.lux @@ -28,24 +28,24 @@ (def: .public (value stack) (All (_ a) (-> (Stack a) (Maybe a))) (case (:representation stack) - #.End - #.None + {.#End} + {.#None} - {#.Item value _} - {#.Some value})) + {.#Item value _} + {.#Some value})) (def: .public (next stack) (All (_ a) (-> (Stack a) (Maybe [a (Stack a)]))) (case (:representation stack) - #.End - #.None + {.#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 281e9f2ed..4beb81cf3 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 5cef4d130..01e125e9d 100644 --- a/stdlib/source/library/lux/data/collection/tree/finger.lux +++ b/stdlib/source/library/lux/data/collection/tree/finger.lux @@ -91,21 +91,21 @@ _node root] (case _node {0 #0 value} - {#.Some value} + {.#Some value} {0 #1 [left right]} (let [shifted_tag (tag//composite _tag (..tag left))] (if (predicate shifted_tag) (recur _tag (value@ #root (:representation left))) (recur shifted_tag (value@ #root (:representation right)))))))) - #.None))) + {.#None}))) ) (def: .public (exists? predicate tree) (All (_ @ t v) (-> (Predicate t) (Tree @ t v) Bit)) (case (..one predicate tree) - {#.Some _} + {.#Some _} true - #.None + {.#None} false)) diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux index 60c11d032..767365e6f 100644 --- a/stdlib/source/library/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux @@ -46,7 +46,7 @@ (def: .public (zipper tree) (All (_ a) (-> (Tree a) (Zipper a))) - [#family #.None + [#family {.#None} #node tree]) (def: .public tree @@ -55,19 +55,19 @@ (def: .public value (All (_ a) (-> (Zipper a) a)) - (value@ [#node #//.value])) + (value@ [#node //.#value])) (def: .public (set value zipper) (All (_ a) (-> a (Zipper a) (Zipper a))) - (with@ [#node #//.value] value zipper)) + (with@ [#node //.#value] value zipper)) (def: .public (update transform zipper) (All (_ a) (-> (-> a a) (Zipper a) (Zipper a))) - (revised@ [#node #//.value] transform zipper)) + (revised@ [#node //.#value] transform zipper)) (def: children (All (_ a) (-> (Zipper a) (List (Tree a)))) - (value@ [#node #//.children])) + (value@ [#node //.#children])) (def: .public leaf? (All (_ a) (-> (Zipper a) Bit)) @@ -80,7 +80,7 @@ (def: .public (start? zipper) (All (_ a) (-> (Zipper a) Bit)) (case (value@ #family zipper) - #.None + {.#None} true _ @@ -89,12 +89,12 @@ (def: .public (down zipper) (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case (..children zipper) - #.End - #.None + {.#End} + {.#None} - {#.Item head tail} - {#.Some [#family {#.Some [#parent (with@ [#node #//.children] (list) zipper) - #lefts #.End + {.#Item head tail} + {.#Some [#family {.#Some [#parent (with@ [#node //.#children] (list) zipper) + #lefts {.#End} #rights tail]} #node head]})) @@ -106,64 +106,64 @@ (for [@.old (revised@ #node (: (-> (Tree (:parameter 0)) (Tree (:parameter 0))) - (with@ #//.children (list\composite (list.reversed lefts) - {#.Item (value@ #node zipper) - rights}))) - parent)] - (with@ [#node #//.children] - (list\composite (list.reversed lefts) - {#.Item (value@ #node zipper) - rights}) - parent)))))) + (with@ //.#children (list\composite (list.reversed #lefts) + {.#Item (value@ #node zipper) + #rights}))) + #parent)] + (with@ [#node //.#children] + (list\composite (list.reversed #lefts) + {.#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)} + (revised@ <op_side> (|>> {.#Item (value@ #node zipper)})))))] + [#family {.#Some (move side' zipper family)} #node next]))} - #.End - #.None) + {.#End} + {.#None}) - #.None - #.None)) + {.#None} + {.#None})) (def: .public (<all> zipper) (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case (value@ #family zipper) - #.None - #.None + {.#None} + {.#None} - {#.Some family} + {.#Some family} (case (list.reversed (value@ <side> family)) - #.End - #.None + {.#End} + {.#None} - {#.Item last prevs} - {#.Some (for [@.old [#family {#.Some (|> family - (with@ <side> #.End) - (revised@ <op_side> (|>> {#.Item (value@ #node zipper)} + {.#Item last prevs} + {.#Some (for [@.old [#family {.#Some (|> family + (with@ <side> {.#End}) + (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)} + (|>> (with@ <side> {.#End}) + (revised@ <op_side> (|>> {.#Item (value@ #node zipper)} (list\composite prevs))))))] - [#family {#.Some (move prevs zipper family)} + [#family {.#Some (move prevs zipper family)} #node last]))})))] [right rightmost #rights #lefts] @@ -173,16 +173,16 @@ (def: .public (next zipper) (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case (..down zipper) - {#.Some forward} - {#.Some forward} + {.#Some forward} + {.#Some forward} - #.None + {.#None} (loop [@ zipper] (case (..right @) - {#.Some forward} - {#.Some forward} + {.#Some forward} + {.#Some forward} - #.None + {.#None} (do maybe.monad [@ (..up @)] (recur @)))))) @@ -190,45 +190,45 @@ (def: (bottom zipper) (All (_ a) (-> (Zipper a) (Zipper a))) (case (..right zipper) - {#.Some forward} + {.#Some forward} (bottom forward) - #.None + {.#None} (case (..down zipper) - {#.Some forward} + {.#Some forward} (bottom forward) - #.None + {.#None} zipper))) (def: .public (previous zipper) (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case (..left zipper) - #.None + {.#None} (..up zipper) - {#.Some backward} - {#.Some (case (..down backward) - {#.Some then} + {.#Some backward} + {.#Some (case (..down backward) + {.#Some then} (..bottom then) - #.None + {.#None} backward)})) (template [<name> <move>] [(def: .public (<name> zipper) (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case (<move> zipper) - #.None - #.None + {.#None} + {.#None} - {#.Some @} + {.#Some @} (loop [@ @] (case (<move> @) - #.None - {#.Some @} + {.#None} + {.#Some @} - {#.Some @} + {.#Some @} (recur @)))))] [end ..next] @@ -238,22 +238,22 @@ (def: .public (end? zipper) (All (_ a) (-> (Zipper a) Bit)) (case (..end zipper) - #.None + {.#None} true - {#.Some _} + {.#Some _} false)) (def: .public (interpose value zipper) (All (_ a) (-> a (Zipper a) (Zipper a))) - (revised@ [#node #//.children] + (revised@ [#node //.#children] (|>> (//.branch value) list) zipper)) (def: .public (adopt value zipper) (All (_ a) (-> a (Zipper a) (Zipper a))) - (revised@ [#node #//.children] - (|>> {#.Item (//.leaf value)}) + (revised@ [#node //.#children] + (|>> {.#Item (//.leaf value)}) zipper)) (def: .public (remove zipper) @@ -261,28 +261,28 @@ (do maybe.monad [family (value@ #family zipper)] (case (value@ #lefts family) - #.End - (in (with@ [#node #//.children] + {.#End} + (in (with@ [#node //.#children] (value@ #rights family) (value@ #parent family))) - {#.Item next side} + {.#Item next side} (in (|> zipper (with@ #family (|> family (with@ #lefts side) - #.Some)) + {.#Some})) (with@ #node next)))))) (template [<name> <side>] [(def: .public (<name> value zipper) (All (_ a) (-> a (Zipper a) (Maybe (Zipper a)))) (case (value@ #family zipper) - #.None - #.None + {.#None} + {.#None} - {#.Some family} - {#.Some (with@ #family - {#.Some (revised@ <side> (|>> {#.Item (//.leaf value)}) family)} + {.#Some family} + {.#Some (with@ #family + {.#Some (revised@ <side> (|>> {.#Item (//.leaf value)}) family)} zipper)}))] [insert_left #lefts] @@ -294,29 +294,31 @@ (def: (each f (^slots [#family #node])) [#family (maybe\each (function (_ (^slots [#parent #lefts #rights])) - [#parent (each f parent) - #lefts (list\each (//\each f) lefts) - #rights (list\each (//\each f) rights)]) - family) - #node (//\each f node)])) + [#parent (each f #parent) + #lefts (list\each (//\each f) #lefts) + #rights (list\each (//\each f) #rights)]) + #family) + #node (//\each f #node)])) (implementation: .public comonad (CoMonad Zipper) - (def: &functor ..functor) + (def: &functor + ..functor) - (def: out (value@ [#node #//.value])) + (def: out + (value@ [#node //.#value])) (def: (disjoint (^slots [#family #node])) (let [tree_splitter (: (All (_ a) (-> (Tree a) (Tree (Zipper a)))) (function (tree_splitter tree) - [#//.value (..zipper tree) - #//.children (|> tree - (value@ #//.children) + [//.#value (..zipper tree) + //.#children (|> tree + (value@ //.#children) (list\each tree_splitter))]))] [#family (maybe\each (function (_ (^slots [#parent #lefts #rights])) - [#parent (disjoint parent) - #lefts (list\each tree_splitter lefts) - #rights (list\each tree_splitter rights)]) - family) - #node (tree_splitter node)]))) + [..#parent (disjoint #parent) + ..#lefts (list\each tree_splitter #lefts) + ..#rights (list\each tree_splitter #rights)]) + #family) + #node (tree_splitter #node)]))) diff --git a/stdlib/source/library/lux/data/color/named.lux b/stdlib/source/library/lux/data/color/named.lux index 822708ccc..26deaeaa6 100644 --- a/stdlib/source/library/lux/data/color/named.lux +++ b/stdlib/source/library/lux/data/color/named.lux @@ -8,9 +8,9 @@ (template [<red> <green> <blue> <name>] [(`` (def: .public <name> Color - (//.of_rgb [#//.red (hex <red>) - #//.green (hex <green>) - #//.blue (hex <blue>)])))] + (//.of_rgb [//.#red (hex <red>) + //.#green (hex <green>) + //.#blue (hex <blue>)])))] ["F0" "F8" "FF" alice_blue] ["FA" "EB" "D7" antique_white] diff --git a/stdlib/source/library/lux/data/format/binary.lux b/stdlib/source/library/lux/data/format/binary.lux index 0fcc94723..8905c32bf 100644 --- a/stdlib/source/library/lux/data/format/binary.lux +++ b/stdlib/source/library/lux/data/format/binary.lux @@ -94,8 +94,8 @@ try.trusted [(.++ offset)] caseT))])]) - ([0 #.Left left] - [1 #.Right right]) + ([0 .#Left left] + [1 .#Right right]) ))) (def: .public (and pre post) @@ -242,17 +242,17 @@ try.trusted [(.++ offset)] caseT))])]) - ([0 #.Primitive (..and ..text (..list recur))] - [1 #.Sum pair] - [2 #.Product pair] - [3 #.Function pair] - [4 #.Parameter indexed] - [5 #.Var indexed] - [6 #.Ex indexed] - [7 #.UnivQ quantified] - [8 #.ExQ quantified] - [9 #.Apply pair] - [10 #.Named (..and ..name recur)]) + ([0 .#Primitive (..and ..text (..list recur))] + [1 .#Sum pair] + [2 .#Product pair] + [3 .#Function pair] + [4 .#Parameter indexed] + [5 .#Var indexed] + [6 .#Ex indexed] + [7 .#UnivQ quantified] + [8 .#ExQ quantified] + [9 .#Apply pair] + [10 .#Named (..and ..name recur)]) )))))) (def: .public location @@ -277,15 +277,14 @@ try.trusted [(.++ offset)] caseT))])]) - ([00 #.Bit ..bit] - [01 #.Nat ..nat] - [02 #.Int ..int] - [03 #.Rev ..rev] - [04 #.Frac ..frac] - [05 #.Text ..text] - [06 #.Identifier ..name] - [07 #.Tag ..name] - [08 #.Form sequence] - [09 #.Variant sequence] - [10 #.Tuple sequence]) + ([0 .#Bit ..bit] + [1 .#Nat ..nat] + [2 .#Int ..int] + [3 .#Rev ..rev] + [4 .#Frac ..frac] + [5 .#Text ..text] + [6 .#Identifier ..name] + [7 .#Form sequence] + [8 .#Variant sequence] + [9 .#Tuple sequence]) ))))))) diff --git a/stdlib/source/library/lux/data/format/css.lux b/stdlib/source/library/lux/data/format/css.lux index 488ccba64..90cb8ad54 100644 --- a/stdlib/source/library/lux/data/format/css.lux +++ b/stdlib/source/library/lux/data/format/css.lux @@ -49,19 +49,19 @@ (def: .public (font font) (-> Font (CSS Special)) - (let [with_unicode (case (value@ #/font.unicode_range font) - {#.Some unicode_range} - (let [unicode_range' (format "U+" (\ nat.hex encoded (value@ #/font.start unicode_range)) - "-" (\ nat.hex encoded (value@ #/font.end unicode_range)))] + (let [with_unicode (case (value@ /font.#unicode_range font) + {.#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'])) - #.None + {.#None} (list))] - (|> (list& ["font-family" (value@ #/font.family font)] - ["src" (format "url(" (value@ #/font.source font) ")")] - ["font-stretch" (|> font (value@ #/font.stretch) (maybe.else /value.normal_stretch) /value.value)] - ["font-style" (|> font (value@ #/font.style) (maybe.else /value.normal_style) /value.value)] - ["font-weight" (|> font (value@ #/font.weight) (maybe.else /value.normal_weight) /value.value)] + (|> (list& ["font-family" (value@ /font.#family font)] + ["src" (format "url(" (value@ /font.#source font) ")")] + ["font-stretch" (|> font (value@ /font.#stretch) (maybe.else /value.normal_stretch) /value.value)] + ["font-style" (|> font (value@ /font.#style) (maybe.else /value.normal_style) /value.value)] + ["font-weight" (|> font (value@ /font.#weight) (maybe.else /value.normal_weight) /value.value)] with_unicode) (list\each (function (_ [property value]) (format property ": " value ";"))) @@ -74,10 +74,10 @@ (-> URL (Maybe Query) (CSS Special)) (:abstraction (format (format "@import url(" (%.text url) ")") (case query - {#.Some query} + {.#Some query} (format " " (/query.query query)) - #.None + {.#None} "") ";"))) diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux index 25b09fb71..ba082cb05 100644 --- a/stdlib/source/library/lux/data/format/css/value.lux +++ b/stdlib/source/library/lux/data/format/css/value.lux @@ -827,7 +827,7 @@ (def: .public (rgba pigment) (-> color.Pigment (Value Color)) - (let [(^slots [#color.color #color.alpha]) pigment + (let [(^slots [color.#color color.#alpha]) pigment [red green blue] (color.rgb color)] (..apply "rgba" (list (%.nat red) (%.nat green) @@ -919,10 +919,10 @@ (def: (with_hint [hint stop]) (-> [(Maybe Hint) Stop] Text) (case hint - #.None + {.#None} (:representation Stop stop) - {#.Some hint} + {.#Some hint} (format (:representation Hint hint) ..value_separator (:representation Stop stop)))))) (type: .public (List/1 a) @@ -1078,10 +1078,10 @@ (Value Image)) (let [after_extent (format "at " (:representation location)) with_extent (case extent - {#.Some extent} + {.#Some extent} (format (..extent extent) " " after_extent) - #.None + {.#None} after_extent) where (format (..shape shape) " " with_extent) [now after] next] @@ -1158,13 +1158,13 @@ (def: .public (font_family options) (-> (List Font) (Value Font)) (case options - {#.Item _} + {.#Item _} (|> options (list\each ..font_name) (text.interposed ",") (:abstraction Value)) - #.End + {.#End} ..initial))]) (def: .public font_size diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux index 72ec3e7a1..60c405963 100644 --- a/stdlib/source/library/lux/data/format/html.lux +++ b/stdlib/source/library/lux/data/format/html.lux @@ -176,10 +176,10 @@ (-> URL (Maybe Target) Meta) (let [partial (list ["href" href]) full (case target - {#.Some target} + {.#Some target} (list& ["target" (..target target)] partial) - #.None + {.#None} partial)] (..simple "base" full))) @@ -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) @@ -300,10 +300,10 @@ ($_ ..and for (case (list\each (product.uncurried ..area) areas) - #.End + {.#End} (..empty "map" attributes) - {#.Item head tail} + {.#Item head tail} (..tag "map" attributes (list\mix (function.flipped ..and) head tail))))) @@ -348,12 +348,12 @@ (-> (Maybe Content) Attributes <type> <type>) (..tag <container_tag> attributes (case description - {#.Some description} + {.#Some description} ($_ ..and (..tag <description_tag> (list) description) content) - #.None + {.#None} content)))] [details "details" "summary" Element] @@ -466,10 +466,10 @@ (..term term) (..description description))) descriptions) - #.End + {.#End} (..empty "dl" attributes) - {#.Item head tail} + {.#Item head tail} (..tag "dl" attributes (list\mix (function.flipped ..and) head tail)))) @@ -524,32 +524,32 @@ (-> Attributes (Maybe Content) (Maybe Column) Header (List Cell) (Maybe Cell) Element) (let [head (..table_head (..table_row headers)) content (case (list\each table_row rows) - #.End + {.#End} head - {#.Item first rest} + {.#Item first rest} (..and head (..table_body (list\mix (function.flipped ..and) first rest)))) content (case footer - #.None + {.#None} content - {#.Some footer} + {.#Some footer} (..and content (..table_foot (..table_row footer)))) content (case columns - #.None + {.#None} content - {#.Some columns} + {.#Some columns} (..and (..columns_group columns) content)) content (case caption - #.None + {.#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 f29042a83..734a38177 100644 --- a/stdlib/source/library/lux/data/format/json.lux +++ b/stdlib/source/library/lux/data/format/json.lux @@ -60,12 +60,12 @@ (def: .public null? (Predicate JSON) - (|>> (case> #Null true + (|>> (case> {#Null} true _ false))) (def: .public object (-> (List [String JSON]) JSON) - (|>> (dictionary.of_list text.hash) #..Object)) + (|>> (dictionary.of_list text.hash) {..#Object})) (type: JSON' (Rec JSON' @@ -83,7 +83,7 @@ (<>.rec (function (_ jsonP) ($_ <>.or - (<code>.local_tag! "null") + (<code>.form (<>\in [])) <code>.bit <code>.frac <code>.text @@ -98,20 +98,20 @@ (-> JSON' Code) (case token {#Null' _} - (` #..Null) + (` {..#Null}) (^template [<ctor> <input_tag> <output_tag>] [{<input_tag> value} (` {<output_tag> (~ (<ctor> value))})]) - ([code.bit #..Boolean' #..Boolean] - [code.frac #..Number' #..Number] - [code.text #..String' #..String]) + ([code.bit ..#Boolean' ..#Boolean] + [code.frac ..#Number' ..#Number] + [code.text ..#String' ..#String]) {#Array' members} - (` {#..Array ((~! row.row) (~+ (row.list (row\each jsonF members))))}) + (` {..#Array ((~! row.row) (~+ (row.list (row\each jsonF members))))}) {#Object' pairs} - (` {#..Object ((~! dictionary.of_list) + (` {..#Object ((~! dictionary.of_list) (~! text.hash) (list (~+ (|> pairs dictionary.entries @@ -128,46 +128,46 @@ (-> JSON (Try (List String))) (case json {#Object obj} - {#try.Success (dictionary.keys 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} (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.")}) + {.#None} + {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)}} + {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] @@ -181,7 +181,7 @@ (def: (= x y) (case [x y] - [#Null #Null] + [{#Null} {#Null}] #1 (^template [<tag> <struct>] @@ -208,8 +208,8 @@ (list\mix (function (_ [xk xv] prev) (and prev (case (dictionary.value xk ys) - #.None #0 - {#.Some yv} (= xv yv)))) + {.#None} #0 + {.#Some yv} (= xv yv)))) #1 (dictionary.entries xs))) @@ -352,10 +352,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 8f64a70f0..0e45ec331 100644 --- a/stdlib/source/library/lux/data/format/markdown.lux +++ b/stdlib/source/library/lux/data/format/markdown.lux @@ -110,14 +110,14 @@ (list\each (function (_ [idx [summary detail]]) (format "1. " (:representation summary) (case detail - {#.Some detail} + {.#Some detail} (|> detail :representation ..indent (text.enclosed [text.new_line text.new_line]) (format text.new_line)) - #.None + {.#None} "")))) (text.interposed text.new_line) ..block)) @@ -128,14 +128,14 @@ (|>> (list\each (function (_ [summary detail]) (format "* " (:representation summary) (case detail - {#.Some detail} + {.#Some detail} (|> detail :representation ..indent (text.enclosed [text.new_line text.new_line]) (format text.new_line)) - #.None + {.#None} "")))) (text.interposed text.new_line) ..block)) diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux index c33250527..bfc337c87 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> @@ -848,14 +848,14 @@ (def: entry_parser (Parser Entry) ($_ <>.either - (\ <>.monad each (|>> #..Normal) + (\ <>.monad each (|>> {..#Normal}) (<>.either (..file_parser ..normal) (..file_parser ..old_normal))) - (\ <>.monad each (|>> #..Symbolic_Link) + (\ <>.monad each (|>> {..#Symbolic_Link}) (..file_name_parser ..symbolic_link (value@ #link_name))) - (\ <>.monad each (|>> #..Directory) + (\ <>.monad each (|>> {..#Directory}) (..file_name_parser ..directory (value@ #path))) - (\ <>.monad each (|>> #..Contiguous) + (\ <>.monad each (|>> {..#Contiguous}) (..file_parser ..contiguous)))) ... It's safe to implement the parser this way because the range of values for Nat is 2^64 diff --git a/stdlib/source/library/lux/data/format/xml.lux b/stdlib/source/library/lux/data/format/xml.lux index 90aaa1b1e..f2064c166 100644 --- a/stdlib/source/library/lux/data/format/xml.lux +++ b/stdlib/source/library/lux/data/format/xml.lux @@ -58,10 +58,10 @@ (|> (do <>.monad [hex? (<>.maybe (<text>.this "x")) code (case hex? - #.None + {.#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 ";")) @@ -92,10 +92,10 @@ [first_part xml_identifier ?second_part (<| <>.maybe (<>.after (<text>.this ..namespace_separator)) xml_identifier)] (case ?second_part - #.None + {.#None} (in ["" first_part]) - {#.Some second_part} + {.#Some second_part} (in [first_part second_part])))) (def: tag^ namespaced_symbol^) @@ -159,7 +159,7 @@ (Parser XML) (|> (..spaced^ (<text>.many xml_char^)) (<>.either cdata^) - (<>\each (|>> #Text)))) + (<>\each (|>> {#Text})))) (def: null^ (Parser Any) diff --git a/stdlib/source/library/lux/data/name.lux b/stdlib/source/library/lux/data/name.lux index 79d1feef3..86f813cf7 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 174a2936f..cd66c8aa4 100644 --- a/stdlib/source/library/lux/data/sum.lux +++ b/stdlib/source/library/lux/data/sum.lux @@ -36,13 +36,13 @@ [(def: .public (<name> items) (All (_ a b) (-> (List (Or a b)) (List <side>))) (case items - #.End - #.End + {.#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] @@ -52,24 +52,24 @@ (def: .public (partition xs) (All (_ a b) (-> (List (Or a b)) [(List a) (List b)])) (case xs - #.End - [#.End #.End] + {.#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 7823bd333..a95490493 100644 --- a/stdlib/source/library/lux/data/text.lux +++ b/stdlib/source/library/lux/data/text.lux @@ -53,8 +53,8 @@ (def: .public (char index input) (-> Nat Text (Maybe Char)) (if (n.< ("lux text size" input) index) - {#.Some ("lux text char" index input)} - #.None)) + {.#Some ("lux text char" index input)} + {.#None})) (def: .public (index_since offset pattern input) (-> Nat Text Text (Maybe Nat)) @@ -68,19 +68,19 @@ (-> Text Text (Maybe Nat)) (loop [offset 0 output (: (Maybe Nat) - #.None)] + {.#None})] (let [output' ("lux text index" offset part text)] (case output' - #.None + {.#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 _ @@ -133,24 +133,24 @@ (def: .public (clip offset size input) (-> Nat Nat Text (Maybe Text)) (if (|> size (n.+ offset) (n.> ("lux text size" input))) - #.None - {#.Some ("lux text clip" offset size input)})) + {.#None} + {.#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)}))) + {.#None} + {.#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)) + {.#None})) (def: .public (split_by token sample) (-> Text Text (Maybe [Text Text])) @@ -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 + {.#None} (|> output - {#.Item input} + {.#Item input} list.reversed)))) (def: .public (replaced/1 pattern replacement template) @@ -219,10 +219,10 @@ (loop [left "" right template] (case (..split_by pattern right) - {#.Some [pre post]} + {.#Some [pre post]} (recur ($_ "lux text concat" left pre replacement) post) - #.None + {.#None} ("lux text concat" left right))))) (implementation: .public equivalence diff --git a/stdlib/source/library/lux/data/text/encoding/utf8.lux b/stdlib/source/library/lux/data/text/encoding/utf8.lux index fc063228e..40b58a7dc 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> @@ -121,23 +121,23 @@ (cond ffi.on_nashorn? (|> ("js object new" ("js constant" "java.lang.String") [value "utf8"]) (:as Text) - #try.Success) + {try.#Success}) ffi.on_node_js? (|> (Buffer::from|decoded [value]) (Buffer::toString ["utf8"]) - #try.Success) + {try.#Success}) ... On the browser (|> (TextDecoder::new [(//.name //.utf_8)]) (TextDecoder::decode [value]) - #try.Success)) + {try.#Success})) @.python (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 @@ -145,17 +145,17 @@ (RubyArray::pack ["C*"]) (:as RubyString) (RubyString::force_encoding ["UTF-8"]) - #try.Success) + {try.#Success}) @.php (|> value ("php pack" ..php_byte_array_format) - #try.Success) + {try.#Success}) @.scheme (|> value ..utf8->string - #try.Success)]))) + {try.#Success})]))) (implementation: .public codec (Codec Binary Text) diff --git a/stdlib/source/library/lux/data/text/escape.lux b/stdlib/source/library/lux/data/text/escape.lux index 422239a27..67e31e72c 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']}) - {#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))}))) (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 b22f3ce00..03de3ed04 100644 --- a/stdlib/source/library/lux/data/text/format.lux +++ b/stdlib/source/library/lux/data/text/format.lux @@ -125,8 +125,8 @@ (All (_ a) (-> (Format a) (Format (Maybe a)))) (function (_ value) (case value - #.None - "#.None" + {.#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 63b112bb4..189665302 100644 --- a/stdlib/source/library/lux/data/text/regex.lux +++ b/stdlib/source/library/lux/data/text/regex.lux @@ -110,8 +110,8 @@ re_range^ re_options^))] (in (case negate? - {#.Some _} (` ((~! <text>.not) ($_ ((~! <>.either)) (~+ parts)))) - #.None (` ($_ ((~! <>.either)) (~+ parts))))))) + {.#Some _} (` ((~! <text>.not) ($_ ((~! <>.either)) (~+ parts)))) + {.#None} (` ($_ ((~! <>.either)) (~+ parts))))))) (def: re_user_class^ (Parser Code) @@ -272,7 +272,7 @@ (type: Re_Group (Variant - #Non_Capturing + {#Non_Capturing} {#Capturing [(Maybe Text) Nat]})) (def: (re_sequential^ capturing? re_scoped^ current_module) @@ -290,19 +290,20 @@ [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 + {.#None} [(++ idx) (code.identifier ["" (n\encoded idx)])]) access (if (n.> 0 num_captures) (` ((~! product.left) (~ name!))) @@ -334,31 +335,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) @@ -391,22 +392,22 @@ [_ (<text>.this "(?:") [_ scoped] (re_alternative^ #0 re_scoped^ current_module) _ (<text>.this ")")] - (in [#Non_Capturing scoped])) + (in [{#Non_Capturing} scoped])) (do <>.monad [complex (re_complex^ current_module)] - (in [#Non_Capturing complex])) + (in [{#Non_Capturing} complex])) (do <>.monad [_ (<text>.this "(?<") captured_name name_part^ _ (<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 +418,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 +431,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/block.lux b/stdlib/source/library/lux/data/text/unicode/block.lux index 5abc56ffc..770ae8554 100644 --- a/stdlib/source/library/lux/data/text/unicode/block.lux +++ b/stdlib/source/library/lux/data/text/unicode/block.lux @@ -43,14 +43,14 @@ (-> Block Char) (|>> :representation (value@ <slot>)))] - [start #interval.bottom] - [end #interval.top] + [start interval.bottom] + [end interval.top] ) (def: .public (size block) (-> Block Nat) - (let [start (value@ #interval.bottom (:representation block)) - end (value@ #interval.top (:representation block))] + (let [start (value@ interval.bottom (:representation block)) + end (value@ interval.top (:representation block))] (|> end (n.- start) ++))) (def: .public (within? block char) diff --git a/stdlib/source/library/lux/data/trace.lux b/stdlib/source/library/lux/data/trace.lux index 156497e43..5fdf1b1c4 100644 --- a/stdlib/source/library/lux/data/trace.lux +++ b/stdlib/source/library/lux/data/trace.lux @@ -25,7 +25,7 @@ (def: (out wa) ((value@ #trace wa) - (value@ [#monoid #monoid.identity] wa))) + (value@ [#monoid monoid.#identity] wa))) (def: (disjoint wa) (let [monoid (value@ #monoid wa)] diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux index 7b107d8e5..6e582e3fa 100644 --- a/stdlib/source/library/lux/debug.lux +++ b/stdlib/source/library/lux/debug.lux @@ -125,8 +125,8 @@ (loop [idx 0] (let [member ("lua array read" idx tuple)] (if ("lua object nil?" member) - #.End - {#.Item member (recur (++ idx))})))))] + {.#End} + {.#Item member (recur (++ idx))})))))] (as_is)) (def: (tuple_inspection inspection) @@ -135,7 +135,7 @@ (~~ (as_is)))] (`` (|>> (:as (array.Array Any)) <adaption> - (array.list #.None) + (array.list {.#None}) (list\each inspection) (text.interposed " ") (text.enclosed ["[" "]"]))))) @@ -145,9 +145,9 @@ (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)] + {.#None})] [java/lang/Boolean [(:as .Bit) %.bit]] [java/lang/Long [(:as .Int) %.int]] @@ -155,17 +155,17 @@ [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 - #.None #0)] + {.#Some _} #1 + {.#None} #0)] (|> (%.format (%.nat (.nat (java/lang/Integer::longValue tag))) " " (%.bit last?) " " (inspection choice)) @@ -173,7 +173,7 @@ _ (tuple_inspection inspection value))) - #.None) + {.#None}) (java/lang/Object::toString object))))] (for [@.old <jvm> @.jvm <jvm> @@ -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)) @@ -300,7 +300,7 @@ [("ruby object nil") Any (new> "nil" [])] )) - (same? (class_of #.None) value_class) + (same? (class_of {.#None}) value_class) (let [variant_tag ("ruby object get" "_lux_tag" value) variant_flag ("ruby object get" "_lux_flag" value) variant_value ("ruby object get" "_lux_value" 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 + {.#End} [lefts #1 (rightR right)] _ - (recur (++ lefts) {#.Item rightR extraR+} right))) + (recur (++ lefts) {.#Item rightR extraR+} right))) _ (undefined)))] @@ -472,13 +472,13 @@ (let [tuple_body (loop [representations membersR+ tupleV tupleV] (case representations - #.End + {.#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,10 +496,10 @@ (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 + {.#None} (<>.failure ""))) (do <>.monad @@ -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]) @@ -546,9 +546,9 @@ (def: target (<code>.Parser Target) (<>.either (<>.and <code>.local_identifier - (\ <>.monad in #.None)) + (\ <>.monad in {.#None})) (<code>.tuple (<>.and <code>.local_identifier - (\ <>.monad each (|>> #.Some) <code>.any))))) + (\ <>.monad each (|>> {.#Some}) <code>.any))))) (exception: .public (unknown_local_binding [name Text]) (exception.report @@ -569,10 +569,10 @@ (dictionary.of_list text.hash))] targets (: (Meta (List Target)) (case targets - #.End + {.#End} (|> environment dictionary.keys - (list\each (function (_ local) [local #.None])) + (list\each (function (_ local) [local {.#None}])) in) _ @@ -586,10 +586,10 @@ ((~! exception.report) (~+ (list\each (function (_ [name format]) (let [format (case format - #.None + {.#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 7ebe3cfdf..818f08761 100644 --- a/stdlib/source/library/lux/documentation.lux +++ b/stdlib/source/library/lux/documentation.lux @@ -35,7 +35,7 @@ ["[0]" syntax]]]]]]]) (template: (|recursion_dummy|) - [{#.Primitive "" #.End}]) + [{.#Primitive "" {.#End}}]) (type: Fragment (Variant @@ -53,23 +53,22 @@ (^template [<tag>] [[[_ _ column] {<tag> _}] column]) - ([#.Bit] - [#.Nat] - [#.Int] - [#.Rev] - [#.Frac] - [#.Text] - [#.Identifier] - [#.Tag]) + ([.#Bit] + [.#Nat] + [.#Int] + [.#Rev] + [.#Frac] + [.#Text] + [.#Identifier]) (^template [<tag>] [[[_ _ column] {<tag> members}] (|> members (list\each reference_column) (list\mix n.min column))]) - ([#.Form] - [#.Variant] - [#.Tuple]) + ([.#Form] + [.#Variant] + [.#Tuple]) )) (def: (padding reference_column [_ old_line old_column] [_ new_line new_column]) @@ -88,49 +87,45 @@ (def: (code_documentation expected_module old_location reference_column example) (-> Text Location Nat Code [Location Text]) (case example - (^template [<tag> <prefix>] - [[new_location {<tag> [module short]}] - (let [documentation (<| (text.prefix <prefix>) - (cond (text\= expected_module module) - short - - (text\= .prelude_module module) - (format "." short) - - ... else - (%.name [module short])))] - [(revised@ #.column (n.+ (text.size documentation)) new_location) - (format (padding reference_column old_location new_location) - documentation)])]) - ([#.Identifier ""] - [#.Tag syntax.sigil]) + [new_location {.#Identifier [module short]}] + (let [documentation (cond (text\= expected_module module) + short + + (text\= .prelude_module module) + (format "." short) + + ... else + (%.name [module short]))] + [(revised@ .#column (n.+ (text.size documentation)) new_location) + (format (padding reference_column old_location new_location) + documentation)]) (^template [<tag> <format>] [[new_location {<tag> value}] (let [documentation (`` (|> value (~~ (template.spliced <format>))))] - [(revised@ #.column (n.+ (text.size documentation)) new_location) + [(revised@ .#column (n.+ (text.size documentation)) new_location) (format (padding reference_column old_location new_location) documentation)])]) - ([#.Bit [%.bit]] - [#.Nat [%.nat]] - [#.Int [%.int]] - [#.Rev [%.rev]] - [#.Frac [%.frac]] - [#.Text [%.text]]) + ([.#Bit [%.bit]] + [.#Nat [%.nat]] + [.#Int [%.int]] + [.#Rev [%.rev]] + [.#Frac [%.frac]] + [.#Text [%.text]]) (^template [|<| |>| <tag>] [[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)])) - [(revised@ #.column ++ group_location) ""] + [(revised@ .#column ++ group_location) ""] members)] - [(revised@ #.column ++ group_location') + [(revised@ .#column ++ group_location') (format (padding reference_column old_location group_location) |<| members_documentation |>|)])]) - ([syntax.open_form syntax.close_form #.Form] - [syntax.open_variant syntax.close_variant #.Variant] - [syntax.open_tuple syntax.close_tuple #.Tuple]) + ([syntax.open_form syntax.close_form .#Form] + [syntax.open_variant syntax.close_variant .#Variant] + [syntax.open_tuple syntax.close_tuple .#Tuple]) )) (def: blank_line @@ -151,7 +146,7 @@ (let [reference_column (..reference_column example) [location _] example] (|> example - (..code_documentation module (with@ #.column reference_column location) reference_column) + (..code_documentation module (with@ .#column reference_column location) reference_column) product.right)))) (def: parameter_name_options "abcdefghijklmnopqrstuvwxyz") @@ -161,10 +156,10 @@ (-> Nat Text) (format "_" (%.nat id)) ... (case (text.char id ..parameter_name_options) - ... {#.Some char} + ... {.#Some char} ... (text.of_char char) - ... #.None + ... {.#None} ... (format (parameter_type_name (n./ parameter_name_options_count id)) ... (parameter_type_name (n.% parameter_name_options_count id)))) ) @@ -192,7 +187,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 +217,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,14 +247,14 @@ (%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} (format <pre> (%.nat id) <post>)]) - ([#.Var "⌈" "⌋"] - [#.Ex "⟨" "⟩"]) + ([.#Var "⌈" "⌋"] + [.#Ex "⟨" "⟩"]) (^template [<tag> <name> <flat>] [{<tag> _} @@ -271,18 +266,18 @@ (format \n (nested " " body_doc)) (format " " body_doc)) ")"))]) - ([#.UnivQ "All" type.flat_univ_q] - [#.ExQ "Ex" type.flat_ex_q]) + ([.#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 +285,7 @@ (text.interposed " ")) ")")) - {#.Named [_module _name] type} + {.#Named [_module _name] type} (cond (text\= module _module) _name @@ -308,38 +303,38 @@ (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) _ - #.None))) + {.#None}))) (def: (type_definition' nestable? level arity type_function_info tags module type) (-> Bit Nat Nat [Text (List Text)] (List Text) Text Type Text) (case tags (^ (list single_tag)) (format "(Record" \n - " [#" single_tag " " (type_definition' false level arity type_function_info #.None module type) "])") + " [#" single_tag " " (type_definition' false level arity type_function_info {.#None} module type) "])") _ (case type - {#.Primitive name params} + {.#Primitive name params} (case params - #.End + {.#End} (format "(primitive " (%.text name) ")") _ - (format "(primitive " (%.text name) " " (|> params (list\each (type_definition' false level arity type_function_info #.None module)) (text.interposed " ")) ")")) + (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 + {.#End} (format "(Or " (|> members - (list\each (type_definition' false level arity type_function_info #.None module)) + (list\each (type_definition' false level arity type_function_info {.#None} module)) (text.interposed " ")) ")") @@ -348,49 +343,49 @@ (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)) + (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 - (format "[" (|> members (list\each (type_definition' false level arity type_function_info #.None module)) (text.interposed " ")) "]") + {.#End} + (format "[" (|> members (list\each (type_definition' false level arity type_function_info {.#None} module)) (text.interposed " ")) "]") _ (|> members (list.zipped/2 tags) (list\each (function (_ [t_name type]) - (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 (format \n " ")) (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 " ")) + (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) + (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} (format <pre> (%.nat id))]) - ([#.Var "-"] - [#.Ex "+"]) + ([.#Var "-"] + [.#Ex "+"]) (^template [<tag> <name> <flat>] [{<tag> _} @@ -398,21 +393,21 @@ args (level_parameters (n.- arity level) level') body_doc (type_definition' nestable? (n.+ level level') arity type_function_info tags module body) fn_name (case type_function_info - [fn_name #.End] fn_name + [fn_name {.#End}] fn_name _ "_")] (format "(" <name> " " "(" fn_name " " (text.interposed " " args) ")" (if nestable? (format \n (..nested " " body_doc)) (format " " body_doc)) ")"))]) - ([#.UnivQ "All" type.flat_univ_q] - [#.ExQ "Ex" type.flat_ex_q]) + ([.#UnivQ "All" type.flat_univ_q] + [.#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,15 +415,15 @@ (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 - (list\each (type_definition' false level arity type_function_info #.None module)) + (list\each (type_definition' false level arity type_function_info {.#None} module)) (text.interposed " ")) ")")) - {#.Named [_module _name] type} + {.#Named [_module _name] type} (cond (text\= module _module) _name @@ -443,10 +438,10 @@ (-> 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 + {.#None} (..type module type)))) (def: description @@ -515,7 +510,7 @@ (<| ((~! md.heading/3)) (~ (code.text (%.code (let [g!name (|> name product.right code.local_identifier)] (case parameters - #.End + {.#End} g!name _ @@ -552,16 +547,16 @@ (~+ (list\each code.local_identifier parameters)))) ... Description (~+ (case description - {#.Some description} + {.#Some description} (list (` (<| ((~! md.paragraph)) ((~! md.text)) (~ description)))) - #.None + {.#None} (list))) ... Examples (~+ (case examples - #.End + {.#End} (list) _ @@ -587,8 +582,8 @@ (syntax: .public (default [[name parameters] ..declaration]) (let [[_ short] name] (in (list (` (: (.List ..Definition) - (list [#..definition (~ (code.text short)) - #..documentation ((~! ..minimal_definition_documentation) + (list [..#definition (~ (code.text short)) + ..#documentation ((~! ..minimal_definition_documentation) ((~ (code.identifier name)) (~+ (list\each code.local_identifier parameters))))]))))))) @@ -597,8 +592,8 @@ (let [[_ short] name] (in (list (` (.def: .public (~ (code.local_identifier short)) (.List ..Definition) - (.list [#..definition (~ (code.text short)) - #..documentation ((~! ..definition_documentation) + (.list [..#definition (~ (code.text short)) + ..#documentation ((~! ..definition_documentation) ((~ (code.identifier name)) (~+ (list\each code.local_identifier parameters))) (~+ extra))]))))))) @@ -635,13 +630,13 @@ (do meta.monad [expected (meta.exports name)] (in (list (` (: (List Module) - (list& [#..module (~ (code.text name)) - #..description (~ description) - #..expected ((~! ..expected) + (list& [..#module (~ (code.text name)) + ..#description (~ description) + ..#expected ((~! ..expected) (~ (code.text (|> expected (list\each product.left) ..expected_format)))) - #..definitions ((~! list.together) (list (~+ definitions)))] + ..#definitions ((~! list.together) (list (~+ definitions)))] ($_ (\ (~! list.monoid) (~' composite)) (: (List Module) (\ (~! list.monoid) (~' identity))) @@ -652,12 +647,12 @@ (|>> (list.sorted text\<) (list\each (function (_ definition) [(md.snippet definition) - #.None])) + {.#None}])) md.numbered_list)) (def: (module_documentation module) (-> Module (Markdown Block)) - (let [(^slots [#expected]) module] + (let [(^open "_[0]") module] ($_ md.then ... Name (md.heading/1 (value@ #module module)) @@ -672,16 +667,16 @@ (|> module (value@ #definitions) (list.only (|>> (value@ #definition) - (set.member? expected))) + (set.member? _#expected))) ..definitions_documentation) ... Missing documentation (case (|> module (value@ #definitions) (list\mix (function (_ definition missing) (set.lacks (value@ #definition definition) missing)) - expected) + _#expected) set.list) - #.End + {.#End} md.empty missing @@ -691,9 +686,11 @@ ... Un-expected documentation (case (|> module (value@ #definitions) - (list.only (|>> (value@ #definition) (set.member? expected) not)) + (list.only (|>> (value@ #definition) + (set.member? _#expected) + not)) (list\each (value@ #definition))) - #.End + {.#End} md.empty un_expected diff --git a/stdlib/source/library/lux/extension.lux b/stdlib/source/library/lux/extension.lux index e4b320a27..e7851f2d3 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 b827c962f..8230be249 100644 --- a/stdlib/source/library/lux/ffi.js.lux +++ b/stdlib/source/library/lux/ffi.js.lux @@ -144,10 +144,10 @@ (-> Code [Bit Code] Code) (if nullable? (` (case (~ input) - {#.Some (~ g!temp)} + {.#Some (~ g!temp)} (~ g!temp) - #.None + {.#None} ("js object null"))) input)) @@ -164,8 +164,8 @@ (if nullable? (` (let [(~ g!temp) (~ output)] (if ("js object null?" (~ g!temp)) - #.None - {#.Some (~ g!temp)}))) + {.#None} + {.#Some (~ g!temp)}))) (` (let [(~ g!temp) (~ output)] (if (not ("js object null?" (~ g!temp))) (~ g!temp) @@ -330,21 +330,21 @@ (with_identifiers [g!_] (let [constant (` ("js constant" (~ (code.text head))))] (case tail - #.End + {.#End} (in (list (` (: (.Maybe (~ type)) (case (..type_of (~ constant)) "undefined" - #.None + {.#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)) "undefined" - #.None + {.#None} (~ g!_) (..constant (~ type) [(~ (code.local_identifier (%.format head "." next))) @@ -352,10 +352,10 @@ (template: (!defined? <constant>) [(.case (..constant Any <constant>) - #.None + {.#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]" @@ -379,7 +379,7 @@ _ false) - #.None + {.#None} false)) (template: .public (closure <inputs> <output>) diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux index 10f8723c0..c4056320a 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] @@ -178,32 +178,32 @@ (type: Primitive_Mode (Variant - #ManualPrM - #AutoPrM)) + {#ManualPrM} + {#AutoPrM})) (type: .public Privacy (Variant - #PublicP - #PrivateP - #ProtectedP - #DefaultP)) + {#PublicP} + {#PrivateP} + {#ProtectedP} + {#DefaultP})) (type: .public State (Variant - #VolatileS - #FinalS - #DefaultS)) + {#VolatileS} + {#FinalS} + {#DefaultS})) (type: .public Inheritance (Variant - #FinalI - #AbstractI - #DefaultI)) + {#FinalI} + {#AbstractI} + {#DefaultI})) (type: Class_Kind (Variant - #Class - #Interface)) + {#Class} + {#Interface})) (type: StackFrame (primitive "java/lang/StackTraceElement")) @@ -284,8 +284,8 @@ (type: ImportMethodKind (Variant - #StaticIMK - #VirtualIMK)) + {#StaticIMK} + {#VirtualIMK})) (type: ImportMethodCommons (Record @@ -326,7 +326,7 @@ (def: (primitive_type mode type) (-> Primitive_Mode (Type Primitive) Code) (case mode - #ManualPrM + {#ManualPrM} (cond (\ type.equivalence = type.boolean type) (` ..Boolean) (\ type.equivalence = type.byte type) (` ..Byte) (\ type.equivalence = type.short type) (` ..Short) @@ -338,7 +338,7 @@ ... else (undefined)) - #AutoPrM + {#AutoPrM} (cond (\ type.equivalence = type.boolean type) (` .Bit) @@ -362,10 +362,10 @@ (-> (Type Parameter) Code) (`` (<| (~~ (template [<when> <binding> <then>] [(case (<when> type) - {#.Some <binding>} + {.#Some <binding>} <then> - #.None)] + {.#None})] [parser.var? name (code.identifier ["" name])] [parser.wildcard? _ (` .Any)] @@ -382,20 +382,20 @@ (-> Primitive_Mode (Type Value) Code) (`` (<| (~~ (template [<when> <binding> <then>] [(case (<when> type) - {#.Some <binding>} + {.#Some <binding>} <then> - #.None)] + {.#None})] [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}}))])) + {.#None} + (` {.#Primitive (~ (code.text array.type_name)) + {.#Item (~ (value_type mode elementT)) {.#End}}}))])) (undefined) ))) @@ -435,9 +435,9 @@ (^template [<tag>] [[meta {<tag> parts}] [meta {<tag> (list\each (replaced f) parts)}]]) - ([#.Form] - [#.Variant] - [#.Tuple]) + ([.#Form] + [.#Variant] + [.#Tuple]) ast' ast')) @@ -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' _ @@ -700,7 +700,7 @@ (def: annotation_parameters^ (Parser (List Annotation_Parameter)) - (<code>.tuple (<>.some (<>.and <code>.local_tag <code>.any)))) + (<code>.tuple (<>.some (<>.and <code>.text <code>.any)))) (def: annotation^ (Parser Annotation) @@ -734,10 +734,10 @@ inputs (<code>.tuple (<>.some (..type^ total_vars))) output (..return^ total_vars) exs (..throws_decl^ total_vars)] - (in [[name #PublicP anns] [#method_tvars tvars - #method_inputs inputs - #method_output output - #method_exs exs]])))) + (in [[name {#PublicP} anns] [#method_tvars tvars + #method_inputs inputs + #method_output output + #method_exs exs]])))) (def: state_modifier^ (Parser State) @@ -754,7 +754,7 @@ 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^ @@ -838,7 +838,7 @@ annotations ..annotations^ body <code>.any] (in [[#member_name name - #member_privacy #PublicP + #member_privacy {#PublicP} #member_anns annotations] {#OverridenMethod strict_fp? owner_class method_vars self_name arguments return_type body exs}])))) @@ -947,9 +947,9 @@ ?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_kind {#VirtualIMK} #import_member_tvars tvars #import_member_args args #import_member_maybe? maybe? @@ -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 @@ -986,7 +986,7 @@ 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? @@ -1004,17 +1004,17 @@ (def: (privacy_modifier$ pm) (-> Privacy Code) (case pm - #PublicP (code.text "public") - #PrivateP (code.text "private") - #ProtectedP (code.text "protected") - #DefaultP (code.text "default"))) + {#PublicP} (code.text "public") + {#PrivateP} (code.text "private") + {#ProtectedP} (code.text "protected") + {#DefaultP} (code.text "default"))) (def: (inheritance_modifier$ im) (-> Inheritance Code) (case im - #FinalI (code.text "final") - #AbstractI (code.text "abstract") - #DefaultI (code.text "default"))) + {#FinalI} (code.text "final") + {#AbstractI} (code.text "abstract") + {#DefaultI} (code.text "default"))) (def: (annotation_parameter$ [name value]) (-> Annotation_Parameter Code) @@ -1046,17 +1046,17 @@ (let [(^slots [#method_tvars #method_inputs #method_output #method_exs]) method_decl] (` ((~ (code.text name)) [(~+ (list\each annotation$ anns))] - [(~+ (list\each var$ method_tvars))] - [(~+ (list\each class$ method_exs))] - [(~+ (list\each value$ method_inputs))] - (~ (return$ method_output)))))) + [(~+ (list\each var$ #method_tvars))] + [(~+ (list\each class$ #method_exs))] + [(~+ (list\each value$ #method_inputs))] + (~ (return$ #method_output)))))) (def: (state_modifier$ sm) (-> State Code) (case sm - #VolatileS (' "volatile") - #FinalS (' "final") - #DefaultS (' "default"))) + {#VolatileS} (' "volatile") + {#FinalS} (' "final") + {#DefaultS} (' "default"))) (def: (field_decl$ [[name pm anns] field]) (-> [Member_Declaration FieldDecl] Code) @@ -1254,16 +1254,16 @@ (with_identifiers [g!temp] (in (list (` (let [(~ g!temp) (~ expr)] (if ("jvm object null?" (~ g!temp)) - #.None - {#.Some (~ g!temp)}))))))) + {.#None} + {.#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 + {.#None} ("jvm object null"))))))) (syntax: .public (check [class (..type^ (list)) @@ -1273,16 +1273,16 @@ 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) + {.#Some (.:as (~ class_type) (~ g!unchecked))} - #.None))] + {.#None}))] (case unchecked - {#.Some unchecked} + {.#Some unchecked} (in (list (` (: (~ check_type) (let [(~ g!unchecked) (~ unchecked)] (~ check_code)))))) - #.None + {.#None} (in (list (` (: (-> (primitive "java.lang.Object") (~ check_type)) (function ((~ g!_) (~ g!unchecked)) (~ check_code)))))) @@ -1319,7 +1319,7 @@ {#MethodDecl [commons _]} (case (value@ #import_member_kind commons) - #StaticIMK + {#StaticIMK} (value@ #import_member_tvars commons) _ @@ -1339,15 +1339,15 @@ (function (_ [maybe? _]) (with_identifiers [arg_name] (in [maybe? arg_name])))) - import_member_args) - .let [input_jvm_types (list\each product.right import_member_args) + #import_member_args) + .let [input_jvm_types (list\each product.right #import_member_args) arg_types (list\each (: (-> [Bit (Type Value)] Code) (function (_ [maybe? arg]) (let [arg_type (value_type (value@ #import_member_mode commons) arg)] (if maybe? (` (Maybe (~ arg_type))) arg_type)))) - import_member_args)]] + #import_member_args)]] (in [arg_inputs input_jvm_types arg_types]))) _ @@ -1399,10 +1399,10 @@ (-> Primitive_Mode [(Type Value) Code] Code) (let [[unboxed refined post] (: [(Type Value) Code (List Code)] (case mode - #ManualPrM + {#ManualPrM} [unboxed raw (list)] - #AutoPrM + {#AutoPrM} (with_expansions [<special+>' (template.spliced <special+>) <cond_cases> (template [<old> <new> <pre> <post>] [(\ type.equivalence = <old> unboxed) @@ -1420,13 +1420,13 @@ raw) (list)])))) unboxed/boxed (case (dictionary.value unboxed ..boxes) - {#.Some boxed} + {.#Some boxed} (<unbox/box> unboxed boxed refined) - #.None + {.#None} refined)] (case post - #.End + {.#End} unboxed/boxed _ @@ -1495,7 +1495,7 @@ (do meta.monad [.let [enum_type (: Code (case class_tvars - #.End + {.#End} (` (primitive (~ (code.text full_name)))) _ @@ -1535,18 +1535,18 @@ (^slots [#import_member_kind]) commons (^slots [#import_method_name]) method [jvm_op object_ast] (: [Text (List Code)] - (case import_member_kind - #StaticIMK + (case #import_member_kind + {#StaticIMK} ["jvm member invoke static" (list)] - #VirtualIMK + {#VirtualIMK} (case kind - #Class + {#Class} ["jvm member invoke virtual" (list g!obj)] - #Interface + {#Interface} ["jvm member invoke interface" (list g!obj)] ))) @@ -1555,7 +1555,7 @@ (` ((~ (code.text jvm_op)) [(~+ (list\each ..var$ class_tvars))] (~ (code.text full_name)) - (~ (code.text import_method_name)) + (~ (code.text #import_method_name)) [(~+ (list\each ..var$ (value@ #import_member_tvars commons)))] (~+ (|> object_ast (list\each ..un_quoted) @@ -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))))]] @@ -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)) + {#Interface} + {#Class})) - {#.Left _} + {.#Left _} (meta.failure (format "Unknown class: " class_name))))) (syntax: .public (import: [declaration ..declaration^ @@ -1695,7 +1695,7 @@ [type.double "jvm array new double"] [type.char "jvm array new char"])) ... else - (in (list (` (: (~ (value_type #ManualPrM (type.array type))) + (in (list (` (: (~ (value_type {#ManualPrM} (type.array type))) ("jvm array new object" (~ g!size)))))))))) (exception: .public (cannot_convert_to_jvm_type [type .Type]) @@ -1708,11 +1708,11 @@ (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 - #.End + {.#End} (\ meta.monad in <type>) _ @@ -1730,7 +1730,7 @@ (~~ (template [<type>] [(text\= (..reflection (type.array <type>)) name) (case params - #.End + {.#End} (\ meta.monad in (type.array <type>)) _ @@ -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)) @@ -1756,10 +1756,10 @@ (text.starts_with? descriptor.array_prefix name) (case params - #.End + {.#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 + {.#None} <failure>))) params))))) - {#.Apply A F} + {.#Apply A F} (case (lux_type.applied (list A) F) - #.None + {.#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) @@ -1907,7 +1907,7 @@ (in (list (` ("jvm object class" (~ (code.text (..reflection type)))))))) (syntax: .public (type [type (..type^ (list))]) - (in (list (..value_type #ManualPrM type)))) + (in (list (..value_type {#ManualPrM} type)))) (exception: .public (cannot_cast_to_non_object [type (Type Value)]) (exception.report @@ -1918,8 +1918,8 @@ object <code>.any]) (case [(parser.array? type) (parser.class? type)] - (^or [{#.Some _} _] [_ {#.Some _}]) - (in (list (` (.: (~ (..value_type #ManualPrM type)) + (^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 ab6437d36..bfe88282e 100644 --- a/stdlib/source/library/lux/ffi.lua.lux +++ b/stdlib/source/library/lux/ffi.lua.lux @@ -140,10 +140,10 @@ (-> Code [Bit Code] Code) (if nilable? (` (case (~ input) - {#.Some (~ g!temp)} + {.#Some (~ g!temp)} (~ g!temp) - #.None + {.#None} ("lua object nil"))) input)) @@ -152,8 +152,8 @@ (if nilable? (` (let [(~ g!temp) (~ output)] (if ("lua object nil?" (~ g!temp)) - #.None - {#.Some (~ g!temp)}))) + {.#None} + {.#Some (~ g!temp)}))) (` (let [(~ g!temp) (~ output)] (if (not ("lua object nil?" (~ g!temp))) (~ g!temp) @@ -217,7 +217,7 @@ (~+ (list\each (with_nil g!temp) g!inputs))))))))))) (syntax: .public (import: [import ..import]) - ... {#.doc (example "Easily import types, methods, functions and constants." + ... {.#doc (example "Easily import types, methods, functions and constants." ... (import: (os/getenv [..String] "io" "?" ..String)))} (with_identifiers [g!temp] (case import @@ -232,14 +232,14 @@ 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))))) (` ("lua import" (~ (code.text head)))) tail) - #.End + {.#End} (` ("lua import" (~ (code.text class)))))] (in (list& (` (type: (~ g!type) (..Object (primitive (~ (code.text real_class)))))) @@ -309,7 +309,7 @@ ))) (template: .public (closure <inputs> <output>) - ... {#.doc (example "Allows defining closures/anonymous-functions in the form that Lua expects." + ... {.#doc (example "Allows defining closures/anonymous-functions in the form that Lua expects." ... "This is useful for adapting Lux functions for usage by Lua code." ... (: ..Function ... (closure [left right] diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux index c59ae94e8..f54bd2b6b 100644 --- a/stdlib/source/library/lux/ffi.old.lux +++ b/stdlib/source/library/lux/ffi.old.lux @@ -72,8 +72,8 @@ (type: BoundKind (Variant - #UpperBound - #LowerBound)) + {#UpperBound} + {#LowerBound})) (type: GenericType (Rec GenericType @@ -88,32 +88,32 @@ (type: Primitive_Mode (Variant - #ManualPrM - #AutoPrM)) + {#ManualPrM} + {#AutoPrM})) (type: .public Privacy (Variant - #PublicP - #PrivateP - #ProtectedP - #DefaultP)) + {#PublicP} + {#PrivateP} + {#ProtectedP} + {#DefaultP})) (type: .public State (Variant - #VolatileS - #FinalS - #DefaultS)) + {#VolatileS} + {#FinalS} + {#DefaultS})) (type: .public Inheritance (Variant - #FinalI - #AbstractI - #DefaultI)) + {#FinalI} + {#AbstractI} + {#DefaultI})) (type: Class_Kind (Variant - #Class - #Interface)) + {#Class} + {#Interface})) (type: Class_Declaration (Record @@ -211,8 +211,8 @@ (type: ImportMethodKind (Variant - #StaticIMK - #VirtualIMK)) + {#StaticIMK} + {#VirtualIMK})) (type: ImportMethodCommons (Record @@ -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")] @@ -268,14 +268,14 @@ ["void" .Any]) _ - #.None)) + {.#None})) (def: (auto_primitive_type class) (-> Text (Maybe Code)) (case class (^template [<prim> <type>] [<prim> - {#.Some (' <type>)}]) + {.#Some (' <type>)}]) (["boolean" .Bit] ["byte" .Int] ["short" .Int] @@ -286,7 +286,7 @@ ["void" .Any]) _ - #.None)) + {.#None})) (def: safe (-> Text Text) @@ -298,14 +298,14 @@ (-> Primitive_Mode (List Type_Parameter) Bit GenericType Code) Code) (case [name+params mode in_array?] - (^multi [[prim #.End] #ManualPrM #0] + (^multi [[prim {.#End}] {#ManualPrM} #0] [(manual_primitive_type prim) - {#.Some output}]) + {.#Some output}]) output - (^multi [[prim #.End] #AutoPrM #0] + (^multi [[prim {.#End}] {#AutoPrM} #0] [(auto_primitive_type prim) - {#.Some output}]) + {.#Some output}]) output [[name params] _ _] @@ -321,10 +321,10 @@ (and (text\= name pname) (not (list.empty? pbounds)))) type_params) - #.None + {.#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} @@ -335,10 +335,11 @@ (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) )) @@ -355,13 +356,13 @@ (let [=params (list\each (: (-> Type_Parameter Code) (function (_ [pname pbounds]) (case pbounds - #.End + {.#End} (code.identifier ["" pname]) - {#.Item bound1 _} - (class_type #ManualPrM class_params bound1)))) - class_params)] - (` (primitive (~ (code.text (safe class_name))) + {.#Item bound1 _} + (class_type {#ManualPrM} #class_params bound1)))) + #class_params)] + (` (primitive (~ (code.text (safe #class_name))) [(~+ =params)])))) (def: type_var_class Text "java.lang.Object") @@ -374,16 +375,17 @@ (and (text\= name pname) (not (list.empty? pbounds)))) env) - #.None + {.#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} @@ -395,7 +397,7 @@ (format "[" (simple_class$ env param)) (^template [<prim> <class>] - [{#GenericClass <prim> #.End} + [{#GenericClass <prim> {.#End}} <class>]) (["boolean" "[Z"] ["byte" "[B"] @@ -438,9 +440,9 @@ (^template [<tag>] [[meta {<tag> parts}] [meta {<tag> (list\each (pre_walk_replace f) parts)}]]) - ([#.Form] - [#.Variant] - [#.Tuple]) + ([.#Form] + [.#Variant] + [.#Tuple]) ast' ast')) @@ -448,7 +450,7 @@ (def: (parser_replacer p ast) (-> (Parser Code) (-> Code Code)) (case (<>.result p (list ast)) - {#.Right [#.End ast']} + {.#Right [{.#End} ast']} ast' _ @@ -556,12 +558,12 @@ ($_ <>.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)] @@ -572,7 +574,7 @@ [component recur^] (case component (^template [<class> <name>] - [{#GenericClass <name> #.End} + [{#GenericClass <name> {.#End}} (in {#GenericClass <class> (list)})]) (["[Z" "boolean"] ["[B" "byte"] @@ -639,7 +641,7 @@ (def: annotation_params^ (Parser (List AnnotationParam)) - (<code>.tuple (<>.some (<>.and <code>.local_tag <code>.any)))) + (<code>.tuple (<>.some (<>.and <code>.text <code>.any)))) (def: annotation^ (Parser Annotation) @@ -682,10 +684,10 @@ inputs (<code>.tuple (<>.some (..generic_type^ type_vars))) output (..generic_type^ type_vars) exs (..throws_decl^ type_vars)] - (in [[name #PublicP anns] [#method_tvars tvars - #method_inputs inputs - #method_output output - #method_exs exs]])))) + (in [[name {#PublicP} anns] [#method_tvars tvars + #method_inputs inputs + #method_output output + #method_exs exs]])))) (def: state_modifier^ (Parser State) @@ -702,7 +704,7 @@ 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^ @@ -786,7 +788,7 @@ annotations ..annotations^ body <code>.any] (in [[#member_name name - #member_privacy #PublicP + #member_privacy {#PublicP} #member_anns annotations] {#OverridenMethod strict_fp? owner_class method_vars @@ -894,9 +896,9 @@ ?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_kind {#VirtualIMK} #import_member_tvars tvars #import_member_args args #import_member_maybe? maybe? @@ -915,7 +917,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 @@ -931,8 +933,8 @@ ?prim_mode (<>.maybe primitive_mode^) gtype (..generic_type^ owner_vars) maybe? (<>.parses? (<code>.this! (' "?"))) - setter? (<>.parses? (<code>.this! (' #!)))] - (in {#FieldAccessDecl [#import_field_mode (maybe.else #AutoPrM ?prim_mode) + setter? (<>.parses? (<code>.this! (' "!")))] + (in {#FieldAccessDecl [#import_field_mode (maybe.else {#AutoPrM} ?prim_mode) #import_field_name name #import_field_static? static? #import_field_maybe? maybe? @@ -963,17 +965,17 @@ (def: (privacy_modifier$ pm) (-> Privacy JVM_Code) (case pm - #PublicP "public" - #PrivateP "private" - #ProtectedP "protected" - #DefaultP "default")) + {#PublicP} "public" + {#PrivateP} "private" + {#ProtectedP} "protected" + {#DefaultP} "default")) (def: (inheritance_modifier$ im) (-> Inheritance JVM_Code) (case im - #FinalI "final" - #AbstractI "abstract" - #DefaultI "default")) + {#FinalI} "final" + {#AbstractI} "abstract" + {#DefaultI} "default")) (def: (annotation_param$ [name value]) (-> AnnotationParam JVM_Code) @@ -986,8 +988,8 @@ (def: (bound_kind$ kind) (-> BoundKind JVM_Code) (case kind - #UpperBound "<" - #LowerBound ">")) + {#UpperBound} "<" + {#LowerBound} ">")) (def: (generic_type$ gtype) (-> GenericType JVM_Code) @@ -1001,10 +1003,10 @@ {#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]) @@ -1013,11 +1015,13 @@ (def: (class_decl$ (^open "[0]")) (-> Class_Declaration JVM_Code) - (format "(" (safe class_name) " " (spaced (list\each type_param$ class_params)) ")")) + (format "(" (safe #class_name) " " (spaced (list\each type_param$ #class_params)) ")")) (def: (super_class_decl$ (^slots [#super_class_name #super_class_params])) (-> Super_Class_Decl JVM_Code) - (format "(" (safe super_class_name) " " (spaced (list\each generic_type$ super_class_params)) ")")) + (format "(" (safe #super_class_name) + " " (spaced (list\each generic_type$ #super_class_params)) + ")")) (def: (method_decl$ [[name pm anns] method_decl]) (-> [Member_Declaration MethodDecl] JVM_Code) @@ -1025,18 +1029,18 @@ (with_parens (spaced (list name (with_brackets (spaced (list\each annotation$ anns))) - (with_brackets (spaced (list\each type_param$ method_tvars))) - (with_brackets (spaced (list\each generic_type$ method_exs))) - (with_brackets (spaced (list\each generic_type$ method_inputs))) - (generic_type$ method_output)) + (with_brackets (spaced (list\each type_param$ #method_tvars))) + (with_brackets (spaced (list\each generic_type$ #method_exs))) + (with_brackets (spaced (list\each generic_type$ #method_inputs))) + (generic_type$ #method_output)) )))) (def: (state_modifier$ sm) (-> State JVM_Code) (case sm - #VolatileS "volatile" - #FinalS "final" - #DefaultS "default")) + {#VolatileS} "volatile" + {#FinalS} "final" + {#DefaultS} "default")) (def: (field_decl$ [[name pm anns] field]) (-> [Member_Declaration FieldDecl] JVM_Code) @@ -1241,16 +1245,16 @@ (with_identifiers [g!temp] (in (list (` (let [(~ g!temp) (~ expr)] (if ("jvm object null?" (~ g!temp)) - #.None - {#.Some (~ g!temp)}))))))) + {.#None} + {.#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 + {.#None} ("jvm object null"))))))) (syntax: .public (check [class (..generic_type^ (list)) @@ -1260,16 +1264,16 @@ 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) + {.#Some (.:as (~ class_type) (~ g!unchecked))} - #.None))] + {.#None}))] (case unchecked - {#.Some unchecked} + {.#Some unchecked} (in (list (` (: (~ check_type) (let [(~ g!unchecked) (~ unchecked)] (~ check_code)))))) - #.None + {.#None} (in (list (` (: (-> (primitive "java.lang.Object") (~ check_type)) (function ((~ g!_) (~ g!unchecked)) (~ check_code)))))) @@ -1304,7 +1308,7 @@ {#MethodDecl [commons _]} (case (value@ #import_member_kind commons) - #StaticIMK + {#StaticIMK} (value@ #import_member_tvars commons) _ @@ -1324,17 +1328,17 @@ (function (_ [maybe? _]) (with_identifiers [arg_name] (in [maybe? arg_name])))) - import_member_args) + #import_member_args) .let [arg_classes (: (List Text) - (list\each (|>> product.right (simple_class$ (list\composite type_params import_member_tvars))) - import_member_args)) + (list\each (|>> product.right (simple_class$ (list\composite type_params #import_member_tvars))) + #import_member_args)) arg_types (list\each (: (-> [Bit GenericType] Code) (function (_ [maybe? arg]) (let [arg_type (class_type (value@ #import_member_mode commons) type_params arg)] (if maybe? (` (Maybe (~ arg_type))) arg_type)))) - import_member_args)]] + #import_member_args)]] (in [arg_inputs arg_classes arg_types]))) _ @@ -1377,8 +1381,8 @@ (def: (free_type_param? [name bounds]) (-> Type_Parameter Bit) (case bounds - #.End #1 - _ #0)) + {.#End} #1 + _ #0)) (def: (lux_type_parameter [name _]) (-> Type_Parameter Code) @@ -1388,10 +1392,10 @@ [(def: (<name> mode [class expression]) (-> Primitive_Mode [Text Code] Code) (case mode - #ManualPrM + {#ManualPrM} expression - #AutoPrM + {#AutoPrM} (case class "byte" (` (<byte> (~ expression))) "short" (` (<short> (~ expression))) @@ -1442,7 +1446,7 @@ (do [! meta.monad] [.let [enum_type (: Code (case class_tvars - #.End + {.#End} (` (primitive (~ (code.text full_name)))) _ @@ -1477,22 +1481,22 @@ (^slots [#import_member_kind]) commons (^slots [#import_method_name]) method [jvm_op object_ast] (: [Text (List Code)] - (case import_member_kind - #StaticIMK + (case #import_member_kind + {#StaticIMK} ["invokestatic" (list)] - #VirtualIMK + {#VirtualIMK} (case kind - #Class + {#Class} ["invokevirtual" (list g!obj)] - #Interface + {#Interface} ["invokeinterface" (list g!obj)] ))) - jvm_extension (code.text (format "jvm " jvm_op ":" full_name ":" import_method_name ":" (text.interposed "," arg_classes))) + jvm_extension (code.text (format "jvm " jvm_op ":" full_name ":" #import_method_name ":" (text.interposed "," arg_classes))) jvm_interop (|> [(simple_class$ (list) (value@ #import_method_return method)) (` ((~ jvm_extension) (~+ (list\each un_quote object_ast)) (~+ (jvm_extension_inputs (value@ #import_member_mode commons) arg_classes arg_function_inputs))))] @@ -1507,52 +1511,52 @@ {#FieldAccessDecl fad} (do meta.monad [.let [(^open "[0]") fad - base_gtype (class_type import_field_mode type_params import_field_type) + base_gtype (class_type #import_field_mode type_params #import_field_type) classC (class_decl_type$ class) - typeC (if import_field_maybe? + typeC (if #import_field_maybe? (` (Maybe (~ base_gtype))) base_gtype) tvar_asts (: (List Code) (|> class_tvars (list.only free_type_param?) (list\each lux_type_parameter))) - getter_name (code.identifier ["" (..import_name import_format method_prefix import_field_name)]) - setter_name (code.identifier ["" (..import_name import_format method_prefix (format import_field_name "!"))])] + getter_name (code.identifier ["" (..import_name import_format method_prefix #import_field_name)]) + setter_name (code.identifier ["" (..import_name import_format method_prefix (format #import_field_name "!"))])] getter_interop (with_identifiers [g!obj] - (let [getter_call (if import_field_static? + (let [getter_call (if #import_field_static? (` ((~ getter_name) [])) (` ((~ getter_name) [(~ g!obj) (~! <code>.any)]))) - getter_body (<| (auto_convert_output import_field_mode) - [(simple_class$ (list) import_field_type) - (if import_field_static? - (let [jvm_extension (code.text (format "jvm getstatic" ":" full_name ":" import_field_name))] + getter_body (<| (auto_convert_output #import_field_mode) + [(simple_class$ (list) #import_field_type) + (if #import_field_static? + (let [jvm_extension (code.text (format "jvm getstatic" ":" full_name ":" #import_field_name))] (` ((~ jvm_extension)))) - (let [jvm_extension (code.text (format "jvm getfield" ":" full_name ":" import_field_name))] + (let [jvm_extension (code.text (format "jvm getfield" ":" full_name ":" #import_field_name))] (` ((~ jvm_extension) (~ (un_quote g!obj))))))]) - getter_body (if import_field_maybe? + getter_body (if #import_field_maybe? (` ((~! ???) (~ getter_body))) getter_body) - getter_body (if import_field_setter? + getter_body (if #import_field_setter? (` ((~! io.io) (~ getter_body))) getter_body)] (in (` ((~! syntax:) (~ getter_call) ((~' in) (.list (.` (~ getter_body))))))))) setter_interop (: (Meta (List Code)) - (if import_field_setter? + (if #import_field_setter? (with_identifiers [g!obj g!value] - (let [setter_call (if import_field_static? + (let [setter_call (if #import_field_static? (` ((~ setter_name) [(~ g!value) (~! <code>.any)])) (` ((~ setter_name) [(~ g!value) (~! <code>.any) (~ g!obj) (~! <code>.any)]))) - setter_value (auto_convert_input import_field_mode - [(simple_class$ (list) import_field_type) (un_quote g!value)]) - setter_value (if import_field_maybe? + setter_value (auto_convert_input #import_field_mode + [(simple_class$ (list) #import_field_type) (un_quote g!value)]) + setter_value (if #import_field_maybe? (` ((~! !!!) (~ setter_value))) setter_value) - setter_command (format (if import_field_static? "jvm putstatic" "jvm putfield") - ":" full_name ":" import_field_name) + setter_command (format (if #import_field_static? "jvm putstatic" "jvm putfield") + ":" full_name ":" #import_field_name) g!obj+ (: (List Code) - (if import_field_static? + (if #import_field_static? (list) (list (un_quote g!obj))))] (in (list (` ((~! syntax:) (~ setter_call) @@ -1583,12 +1587,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)) + {#Interface} + {#Class})) - {#try.Failure error} + {try.#Failure error} (meta.failure (format "Cannot load class: " class_name text.new_line error))))) @@ -1629,18 +1633,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 + {.#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 +1653,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 +1682,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)] @@ -1707,4 +1711,4 @@ (in (list (` ("jvm object class" (~ (code.text (simple_class$ (list) type)))))))) (syntax: .public (type [type (..generic_type^ (list))]) - (in (list (..class_type #ManualPrM (list) type)))) + (in (list (..class_type {#ManualPrM} (list) type)))) diff --git a/stdlib/source/library/lux/ffi.php.lux b/stdlib/source/library/lux/ffi.php.lux index f39cd314a..94732874e 100644 --- a/stdlib/source/library/lux/ffi.php.lux +++ b/stdlib/source/library/lux/ffi.php.lux @@ -148,10 +148,10 @@ (-> Code [Bit Code] Code) (if nullable? (` (case (~ input) - {#.Some (~ g!temp)} + {.#Some (~ g!temp)} (~ g!temp) - #.Null + {.#Null} ("php object null"))) input)) @@ -160,8 +160,8 @@ (if nullable? (` (let [(~ g!temp) (~ output)] (if ("php object null?" (~ g!temp)) - #.None - {#.Some (~ g!temp)}))) + {.#None} + {.#Some (~ g!temp)}))) (` (let [(~ g!temp) (~ output)] (if (not ("php object null?" (~ g!temp))) (~ g!temp) @@ -187,11 +187,11 @@ )) (syntax: .public (try [expression <code>.any]) - ... {#.doc (example (case (try (risky_computation input)) - ... {#.Right success} + ... {.#doc (example (case (try (risky_computation input)) + ... {.#Right success} ... (do_something success) - ... {#.Left error} + ... {.#Left error} ... (recover_from_failure error)))} (in (list (` ("lux try" ((~! io.io) (~ expression))))))) diff --git a/stdlib/source/library/lux/ffi.py.lux b/stdlib/source/library/lux/ffi.py.lux index fafac379e..b425c9f3b 100644 --- a/stdlib/source/library/lux/ffi.py.lux +++ b/stdlib/source/library/lux/ffi.py.lux @@ -143,10 +143,10 @@ (-> Code [Bit Code] Code) (if noneable? (` (case (~ input) - {#.Some (~ g!temp)} + {.#Some (~ g!temp)} (~ g!temp) - #.None + {.#None} ("python object none"))) input)) @@ -155,8 +155,8 @@ (if noneable? (` (let [(~ g!temp) (~ output)] (if ("python object none?" (~ g!temp)) - #.None - {#.Some (~ g!temp)}))) + {.#None} + {.#Some (~ g!temp)}))) (` (let [(~ g!temp) (~ output)] (if (not ("python object none?" (~ g!temp))) (~ g!temp) @@ -217,7 +217,7 @@ (~+ (list\each (with_none g!temp) g!inputs))))))))))) (syntax: .public (import: [import ..import]) - ... {#.doc (example "Easily import types, methods, functions and constants." + ... {.#doc (example "Easily import types, methods, functions and constants." ... (import: os ... ["[1]::[0]" ... ("static" F_OK ..Integer) @@ -252,14 +252,14 @@ 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))))) (` ("python import" (~ (code.text head)))) tail) - #.End + {.#End} (` ("python import" (~ (code.text class)))))] (in (list& (` (type: (~ g!type) (..Object (primitive (~ (code.text real_class)))))) @@ -334,7 +334,7 @@ ))) (template: .public (lambda <inputs> <output>) - ... {#.doc (example "Allows defining closures/anonymous-functions in the form that Python expects." + ... {.#doc (example "Allows defining closures/anonymous-functions in the form that Python expects." ... "This is useful for adapting Lux functions for usage by Python code." ... (: ..Function ... (lambda [left right] diff --git a/stdlib/source/library/lux/ffi.rb.lux b/stdlib/source/library/lux/ffi.rb.lux index d025b4b23..366dc65de 100644 --- a/stdlib/source/library/lux/ffi.rb.lux +++ b/stdlib/source/library/lux/ffi.rb.lux @@ -148,10 +148,10 @@ (-> Code [Bit Code] Code) (if nilable? (` (case (~ input) - {#.Some (~ g!temp)} + {.#Some (~ g!temp)} (~ g!temp) - #.None + {.#None} ("ruby object nil"))) input)) @@ -160,8 +160,8 @@ (if nilable? (` (let [(~ g!temp) (~ output)] (if ("ruby object nil?" (~ g!temp)) - #.None - {#.Some (~ g!temp)}))) + {.#None} + {.#Some (~ g!temp)}))) (` (let [(~ g!temp) (~ output)] (if (not ("ruby object nil?" (~ g!temp))) (~ g!temp) @@ -243,10 +243,10 @@ 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 + {.#None} (list))) class_import (` ("ruby constant" (~ (code.text class))))] (in (list& (` (type: (~ g!type) @@ -307,10 +307,10 @@ {#Function [name alias inputsT io? try? outputT]} (let [imported (` (.exec (~+ (case ?module - {#.Some module} + {.#Some module} (list (` ("ruby import" (~ (code.text module))))) - #.None + {.#None} (list))) ("ruby constant" (~ (code.text name)))))] (in (list (..make_function (code.local_identifier (maybe.else name alias)) @@ -324,10 +324,10 @@ {#Constant [_ name alias fieldT]} (let [imported (` (.exec (~+ (case ?module - {#.Some module} + {.#Some module} (list (` ("ruby import" (~ (code.text module))))) - #.None + {.#None} (list))) ("ruby constant" (~ (code.text name)))))] (in (list (` ((~! syntax:) ((~ (code.local_identifier (maybe.else name alias))) []) diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux index 5d78822f3..ba47e81ca 100644 --- a/stdlib/source/library/lux/ffi.scm.lux +++ b/stdlib/source/library/lux/ffi.scm.lux @@ -120,10 +120,10 @@ (-> Code [Bit Code] Code) (if nilable? (` (case (~ input) - {#.Some (~ g!temp)} + {.#Some (~ g!temp)} (~ g!temp) - #.None + {.#None} ("scheme object nil"))) input)) @@ -132,8 +132,8 @@ (if nilable? (` (let [(~ g!temp) (~ output)] (if ("scheme object nil?" (~ g!temp)) - #.None - {#.Some (~ g!temp)}))) + {.#None} + {.#Some (~ g!temp)}))) (` (let [(~ g!temp) (~ output)] (if (not ("scheme object nil?" (~ g!temp))) (~ g!temp) @@ -152,11 +152,11 @@ )) (syntax: .public (try [expression <code>.any]) - ... {#.doc (example (case (try (risky_computation input)) - ... {#.Right success} + ... {.#doc (example (case (try (risky_computation input)) + ... {.#Right success} ... (do_something success) - ... {#.Left error} + ... {.#Left error} ... (recover_from_failure error)))} (in (list (` ("lux try" ((~! io.io) (~ expression))))))) diff --git a/stdlib/source/library/lux/macro.lux b/stdlib/source/library/lux/macro.lux index 5962e36fa..c1b8db599 100644 --- a/stdlib/source/library/lux/macro.lux +++ b/stdlib/source/library/lux/macro.lux @@ -21,14 +21,14 @@ (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 + {.#None} (\ //.monad in (list syntax)))) _ @@ -37,18 +37,18 @@ (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 (monad.each //.monad expansion) (\ ! each list\conjoint))) - #.None + {.#None} (\ //.monad in (list syntax)))) _ @@ -57,33 +57,33 @@ (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)] (in (list\conjoint expansion'))) - #.None + {.#None} (do //.monad [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]} + {.#None})) + {.#Some [omit? token]} (do //.monad [location //.location output (<func> token) @@ -169,7 +169,7 @@ (list) output))) - #.None + {.#None} (//.failure (..wrong_syntax_error macro_name)))))] [log_single_expansion! ..single_expansion] diff --git a/stdlib/source/library/lux/macro/code.lux b/stdlib/source/library/lux/macro/code.lux index aaa054c96..b7c709482 100644 --- a/stdlib/source/library/lux/macro/code.lux +++ b/stdlib/source/library/lux/macro/code.lux @@ -20,17 +20,16 @@ ["[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} +... {.#Form (List (w (Code' w)))} +... {.#Variant (List (w (Code' w)))} +... {.#Tuple (List (w (Code' w)))}) ... (type: Code ... (Ann Location (Code' (Ann Location)))) @@ -40,17 +39,16 @@ (-> <type> Code) [location.dummy {<tag> x}])] - [bit Bit #.Bit] - [nat Nat #.Nat] - [int Int #.Int] - [rev Rev #.Rev] - [frac Frac #.Frac] - [text Text #.Text] - [identifier Name #.Identifier] - [tag Name #.Tag] - [form (List Code) #.Form] - [variant (List Code) #.Variant] - [tuple (List Code) #.Tuple] + [bit Bit .#Bit] + [nat Nat .#Nat] + [int Int .#Int] + [rev Rev .#Rev] + [frac Frac .#Frac] + [text Text .#Text] + [identifier Name .#Identifier] + [form (List Code) .#Form] + [variant (List Code) .#Variant] + [tuple (List Code) .#Tuple] ) (template [<name> <tag>] @@ -58,8 +56,7 @@ (-> Text Code) [location.dummy {<tag> ["" name]}])] - [local_identifier #.Identifier] - [local_tag #.Tag]) + [local_identifier .#Identifier]) (implementation: .public equivalence (Equivalence Code) @@ -69,21 +66,20 @@ (^template [<tag> <eq>] [[[_ {<tag> x'}] [_ {<tag> y'}]] (\ <eq> = x' y')]) - ([#.Bit bit.equivalence] - [#.Nat nat.equivalence] - [#.Int int.equivalence] - [#.Rev rev.equivalence] - [#.Frac frac.equivalence] - [#.Text text.equivalence] - [#.Identifier name.equivalence] - [#.Tag name.equivalence]) + ([.#Bit bit.equivalence] + [.#Nat nat.equivalence] + [.#Int int.equivalence] + [.#Rev rev.equivalence] + [.#Frac frac.equivalence] + [.#Text text.equivalence] + [.#Identifier name.equivalence]) (^template [<tag>] [[[_ {<tag> xs'}] [_ {<tag> ys'}]] (\ (list.equivalence =) = xs' ys')]) - ([#.Form] - [#.Variant] - [#.Tuple]) + ([.#Form] + [.#Variant] + [.#Tuple]) _ false))) @@ -94,19 +90,16 @@ (^template [<tag> <struct>] [[_ {<tag> value}] (\ <struct> encoded value)]) - ([#.Bit bit.codec] - [#.Nat nat.decimal] - [#.Int int.decimal] - [#.Rev rev.decimal] - [#.Frac frac.decimal] - [#.Identifier name.codec]) + ([.#Bit bit.codec] + [.#Nat nat.decimal] + [.#Int int.decimal] + [.#Rev rev.decimal] + [.#Frac frac.decimal] + [.#Identifier name.codec]) - [_ {#.Text value}] + [_ {.#Text value}] (text.format value) - [_ {#.Tag name}] - (text\composite "#" (\ name.codec encoded name)) - (^template [<tag> <open> <close>] [[_ {<tag> members}] ($_ text\composite @@ -119,9 +112,9 @@ "" members) <close>)]) - ([#.Form "(" ")"] - [#.Variant "{" "}"] - [#.Tuple "[" "]"]) + ([.#Form "(" ")"] + [.#Variant "{" "}"] + [.#Tuple "[" "]"]) )) (def: .public (replaced original substitute ast) @@ -132,9 +125,9 @@ (^template [<tag>] [[location {<tag> parts}] [location {<tag> (list\each (replaced original substitute) parts)}]]) - ([#.Form] - [#.Variant] - [#.Tuple]) + ([.#Form] + [.#Variant] + [.#Tuple]) _ ast))) diff --git a/stdlib/source/library/lux/macro/local.lux b/stdlib/source/library/lux/macro/local.lux index f53a6473b..7fd34c7b3 100644 --- a/stdlib/source/library/lux/macro/local.lux +++ b/stdlib/source/library/lux/macro/local.lux @@ -35,34 +35,34 @@ (def: (with_module name body) (All (_ a) (-> Text (-> Module (Try [Module a])) (Meta a))) (function (_ compiler) - (case (|> compiler (value@ #.modules) (plist.value name)) - {#.Some module} + (case (|> compiler (value@ .#modules) (plist.value name)) + {.#Some module} (case (body module) - {#try.Success [module' output]} - {#try.Success [(revised@ #.modules (plist.has name module') compiler) + {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 + {.#None} (exception.except ..unknown_module [name])))) (def: (push_one [name macro]) (-> [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) + (case (|> module (value@ .#definitions) (plist.value definition_name)) + {.#None} + {try.#Success [(revised@ .#definitions add_macro! module) []]} - {#.Some _} + {.#Some _} (exception.except ..cannot_shadow_definition [module_name definition_name])))))) (def: (pop_one name) @@ -73,12 +73,12 @@ (plist.lacks definition_name))]] (..with_module module_name (function (_ module) - (case (|> module (value@ #.definitions) (plist.value definition_name)) - {#.Some _} - {#try.Success [(revised@ #.definitions lacks_macro! module) + (case (|> module (value@ .#definitions) (plist.value definition_name)) + {.#Some _} + {try.#Success [(revised@ .#definitions lacks_macro! module) []]} - #.None + {.#None} (exception.except ..unknown_definition [module_name definition_name])))))) (def: (pop_all macros self) @@ -89,11 +89,11 @@ [_ (monad.each ! ..pop_one macros) _ (..pop_one self) compiler meta.compiler_state] - (in (case (value@ #.expected compiler) - {#.Some _} + (in (case (value@ .#expected compiler) + {.#Some _} (list (' [])) - #.None + {.#None} (list))))))) (def: .public (push macros) diff --git a/stdlib/source/library/lux/macro/syntax.lux b/stdlib/source/library/lux/macro/syntax.lux index 3b885c86a..dcf042ead 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)}))) (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')))) + {.#End} {.#End} + {.#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/check.lux b/stdlib/source/library/lux/macro/syntax/check.lux index 54558b914..bdc4d9a98 100644 --- a/stdlib/source/library/lux/macro/syntax/check.lux +++ b/stdlib/source/library/lux/macro/syntax/check.lux @@ -32,8 +32,8 @@ (def: .public (format (^slots [#type #value])) (-> Check Code) (` ((~ (code.text ..extension)) - (~ type) - (~ value)))) + (~ #type) + (~ #value)))) (def: .public parser (Parser Check) diff --git a/stdlib/source/library/lux/macro/syntax/declaration.lux b/stdlib/source/library/lux/macro/syntax/declaration.lux index db8d135ca..bb7abe7b0 100644 --- a/stdlib/source/library/lux/macro/syntax/declaration.lux +++ b/stdlib/source/library/lux/macro/syntax/declaration.lux @@ -37,7 +37,7 @@ (-> Declaration Code) (let [g!name (code.local_identifier (value@ #name value))] (case (value@ #arguments value) - #.End + {.#End} g!name arguments diff --git a/stdlib/source/library/lux/macro/syntax/definition.lux b/stdlib/source/library/lux/macro/syntax/definition.lux index 9cbe2fb1a..feb0f908a 100644 --- a/stdlib/source/library/lux/macro/syntax/definition.lux +++ b/stdlib/source/library/lux/macro/syntax/definition.lux @@ -47,21 +47,21 @@ (def: dummy Code - (` [#.module (~ (code.text (value@ #.module location.dummy))) - #.line (~ (code.nat (value@ #.line location.dummy))) - #.column (~ (code.nat (value@ #.column location.dummy)))])) + (` [.#module (~ (code.text (value@ .#module location.dummy))) + .#line (~ (code.nat (value@ .#line location.dummy))) + .#column (~ (code.nat (value@ .#column location.dummy)))])) (def: .public (format (^slots [#name #value #export?])) (-> Definition Code) (` ((~ (code.text ..extension)) - (~ (code.local_identifier name)) - (~ (case value - {#.Left check} + (~ (code.local_identifier #name)) + (~ (case #value + {.#Left check} (//check.format check) - {#.Right value} + {.#Right value} value)) - (~ (code.bit export?))))) + (~ (code.bit #export?))))) (def: .public (parser compiler) (-> Lux (Parser Definition)) @@ -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 2d33f7098..6fe7afd4b 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 8be738131..6a5136d15 100644 --- a/stdlib/source/library/lux/macro/template.lux +++ b/stdlib/source/library/lux/macro/template.lux @@ -56,18 +56,13 @@ (def: (snippet module_side?) (-> Bit (Parser Text)) - (.let [full_identifier (..name_side module_side? <code>.identifier) - full_tag (..name_side module_side? <code>.tag)] + (.let [full_identifier (..name_side module_side? <code>.identifier)] ($_ <>.either <code>.text (if module_side? full_identifier (<>.either <code>.local_identifier full_identifier)) - (if module_side? - full_tag - (<>.either <code>.local_tag - full_tag)) (<>\each bit\encoded <code>.bit) (<>\each nat\encoded <code>.nat) (<>\each int\encoded <code>.int) @@ -86,15 +81,14 @@ [(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] - [tag code.local_tag code.tag] ) (type: Environment @@ -103,20 +97,20 @@ (def: (applied env template) (-> Environment Code Code) (case template - [_ {#.Identifier "" name}] + [_ {.#Identifier "" name}] (case (dictionary.value name env) - {#.Some substitute} + {.#Some substitute} substitute - #.None + {.#None} template) (^template [<tag>] [[meta {<tag> elems}] [meta {<tag> (list\each (applied env) elems)}]]) - ([#.Form] - [#.Variant] - [#.Tuple]) + ([.#Form] + [.#Variant] + [.#Tuple]) _ template)) @@ -137,13 +131,13 @@ (-> Local Macro) ("lux macro" (function (_ inputs compiler) - (.let [parameters_amount (list.size parameters) + (.let [parameters_amount (list.size #parameters) inputs_amount (list.size inputs)] (if (nat.= parameters_amount inputs_amount) (.let [environment (: Environment - (|> (list.zipped/2 parameters inputs) + (|> (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,11 +156,11 @@ [here_name meta.current_module_name expression? (: (Meta Bit) (function (_ lux) - {#try.Success [lux (case (value@ #.expected lux) - #.None + {try.#Success [lux (case (value@ .#expected lux) + {.#None} false - {#.Some _} + {.#Some _} true)]})) g!pop (local.push (list\each (function (_ local) [[here_name (value@ #name local)] diff --git a/stdlib/source/library/lux/math/infix.lux b/stdlib/source/library/lux/math/infix.lux index de54af790..36dd132d6 100644 --- a/stdlib/source/library/lux/math/infix.lux +++ b/stdlib/source/library/lux/math/infix.lux @@ -35,8 +35,7 @@ (<>\each code.rev <code>.rev) (<>\each code.frac <code>.frac) (<>\each code.text <code>.text) - (<>\each code.identifier <code>.identifier) - (<>\each code.tag <code>.tag))) + (<>\each code.identifier <code>.identifier))) (def: expression (Parser Infix) diff --git a/stdlib/source/library/lux/math/modular.lux b/stdlib/source/library/lux/math/modular.lux index fe9ab2bf9..19d08eb66 100644 --- a/stdlib/source/library/lux/math/modular.lux +++ b/stdlib/source/library/lux/math/modular.lux @@ -136,8 +136,8 @@ (let [[modulus value] (:representation modular) [[vk mk] gcd] (i.extended_gcd value (//.divisor modulus))] (case gcd - +1 {#.Some (..modular modulus vk)} - _ #.None))) + +1 {.#Some (..modular modulus vk)} + _ {.#None}))) ) (exception: .public [r% s%] (moduli_are_not_equal [reference (Modulus r%) @@ -151,6 +151,6 @@ (-> (Modulus r%) (Modulus s%) (Try (-> (Mod s%) (Mod r%))))) (if (//.= reference subject) - {#try.Success (|>> ..value + {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 c94cbde14..9a0b91b99 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 4c20fd9fd..b525754f2 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/complex.lux b/stdlib/source/library/lux/math/number/complex.lux index 8e649252e..e6b447d69 100644 --- a/stdlib/source/library/lux/math/number/complex.lux +++ b/stdlib/source/library/lux/math/number/complex.lux @@ -29,8 +29,8 @@ (syntax: .public (complex [real <code>.any ?imaginary (<>.maybe <code>.any)]) - (in (list (` [#..real (~ real) - #..imaginary (~ (maybe.else (' +0.0) ?imaginary))])))) + (in (list (` [..#real (~ real) + ..#imaginary (~ (maybe.else (' +0.0) ?imaginary))])))) (def: .public i Complex @@ -112,22 +112,22 @@ (def: .public (/ param input) (-> Complex Complex Complex) (let [(^slots [#real #imaginary]) param] - (if (f.< (f.abs imaginary) - (f.abs real)) - (let [quot (f./ imaginary real) - denom (|> real (f.* quot) (f.+ imaginary))] - [#real (|> (value@ #real input) (f.* quot) (f.+ (value@ #imaginary input)) (f./ denom)) - #imaginary (|> (value@ #imaginary input) (f.* quot) (f.- (value@ #real input)) (f./ denom))]) - (let [quot (f./ real imaginary) - denom (|> imaginary (f.* quot) (f.+ real))] - [#real (|> (value@ #imaginary input) (f.* quot) (f.+ (value@ #real input)) (f./ denom)) - #imaginary (|> (value@ #imaginary input) (f.- (f.* quot (value@ #real input))) (f./ denom))])))) + (if (f.< (f.abs #imaginary) + (f.abs #real)) + (let [quot (f./ #imaginary #real) + denom (|> #real (f.* quot) (f.+ #imaginary))] + [..#real (|> (value@ ..#real input) (f.* quot) (f.+ (value@ ..#imaginary input)) (f./ denom)) + ..#imaginary (|> (value@ ..#imaginary input) (f.* quot) (f.- (value@ ..#real input)) (f./ denom))]) + (let [quot (f./ #real #imaginary) + denom (|> #imaginary (f.* quot) (f.+ #real))] + [..#real (|> (value@ ..#imaginary input) (f.* quot) (f.+ (value@ ..#real input)) (f./ denom)) + ..#imaginary (|> (value@ ..#imaginary input) (f.- (f.* quot (value@ ..#real input))) (f./ denom))])))) (def: .public (/' param subject) (-> Frac Complex Complex) (let [(^slots [#real #imaginary]) subject] - [#real (f./ param real) - #imaginary (f./ param imaginary)])) + [..#real (f./ param #real) + ..#imaginary (f./ param #imaginary)])) (def: .public (% param input) (-> Complex Complex Complex) @@ -141,81 +141,81 @@ (def: .public (cos subject) (-> Complex Complex) (let [(^slots [#real #imaginary]) subject] - [#real (f.* (math.cosh imaginary) - (math.cos real)) - #imaginary (f.opposite (f.* (math.sinh imaginary) - (math.sin real)))])) + [..#real (f.* (math.cosh #imaginary) + (math.cos #real)) + ..#imaginary (f.opposite (f.* (math.sinh #imaginary) + (math.sin #real)))])) (def: .public (cosh subject) (-> Complex Complex) (let [(^slots [#real #imaginary]) subject] - [#real (f.* (math.cos imaginary) - (math.cosh real)) - #imaginary (f.* (math.sin imaginary) - (math.sinh real))])) + [..#real (f.* (math.cos #imaginary) + (math.cosh #real)) + ..#imaginary (f.* (math.sin #imaginary) + (math.sinh #real))])) (def: .public (sin subject) (-> Complex Complex) (let [(^slots [#real #imaginary]) subject] - [#real (f.* (math.cosh imaginary) - (math.sin real)) - #imaginary (f.* (math.sinh imaginary) - (math.cos real))])) + [..#real (f.* (math.cosh #imaginary) + (math.sin #real)) + ..#imaginary (f.* (math.sinh #imaginary) + (math.cos #real))])) (def: .public (sinh subject) (-> Complex Complex) (let [(^slots [#real #imaginary]) subject] - [#real (f.* (math.cos imaginary) - (math.sinh real)) - #imaginary (f.* (math.sin imaginary) - (math.cosh real))])) + [..#real (f.* (math.cos #imaginary) + (math.sinh #real)) + ..#imaginary (f.* (math.sin #imaginary) + (math.cosh #real))])) (def: .public (tan subject) (-> Complex Complex) (let [(^slots [#real #imaginary]) subject - r2 (f.* +2.0 real) - i2 (f.* +2.0 imaginary) + r2 (f.* +2.0 #real) + i2 (f.* +2.0 #imaginary) d (f.+ (math.cos r2) (math.cosh i2))] - [#real (f./ d (math.sin r2)) - #imaginary (f./ d (math.sinh i2))])) + [..#real (f./ d (math.sin r2)) + ..#imaginary (f./ d (math.sinh i2))])) (def: .public (tanh subject) (-> Complex Complex) (let [(^slots [#real #imaginary]) subject - r2 (f.* +2.0 real) - i2 (f.* +2.0 imaginary) + r2 (f.* +2.0 #real) + i2 (f.* +2.0 #imaginary) d (f.+ (math.cosh r2) (math.cos i2))] - [#real (f./ d (math.sinh r2)) - #imaginary (f./ d (math.sin i2))])) + [..#real (f./ d (math.sinh r2)) + ..#imaginary (f./ d (math.sin i2))])) (def: .public (abs subject) (-> Complex Frac) (let [(^slots [#real #imaginary]) subject] - (if (f.< (f.abs imaginary) - (f.abs real)) - (if (f.= +0.0 imaginary) - (f.abs real) - (let [q (f./ imaginary real)] + (if (f.< (f.abs #imaginary) + (f.abs #real)) + (if (f.= +0.0 #imaginary) + (f.abs #real) + (let [q (f./ #imaginary #real)] (f.* (math.pow +0.5 (f.+ +1.0 (f.* q q))) - (f.abs imaginary)))) - (if (f.= +0.0 real) - (f.abs imaginary) - (let [q (f./ real imaginary)] + (f.abs #imaginary)))) + (if (f.= +0.0 #real) + (f.abs #imaginary) + (let [q (f./ #real #imaginary)] (f.* (math.pow +0.5 (f.+ +1.0 (f.* q q))) - (f.abs real))))))) + (f.abs #real))))))) (def: .public (exp subject) (-> Complex Complex) (let [(^slots [#real #imaginary]) subject - r_exp (math.exp real)] - [#real (f.* r_exp (math.cos imaginary)) - #imaginary (f.* r_exp (math.sin imaginary))])) + r_exp (math.exp #real)] + [..#real (f.* r_exp (math.cos #imaginary)) + ..#imaginary (f.* r_exp (math.sin #imaginary))])) (def: .public (log subject) (-> Complex Complex) (let [(^slots [#real #imaginary]) subject] - [#real (|> subject ..abs math.log) - #imaginary (math.atan/2 real imaginary)])) + [..#real (|> subject ..abs math.log) + ..#imaginary (math.atan/2 #real #imaginary)])) (template [<name> <type> <op>] [(def: .public (<name> param input) @@ -233,14 +233,14 @@ (def: .public (root/2 input) (-> Complex Complex) (let [(^slots [#real #imaginary]) input - t (|> input ..abs (f.+ (f.abs real)) (f./ +2.0) (math.pow +0.5))] - (if (f.< +0.0 real) - [#real (f./ (f.* +2.0 t) - (f.abs imaginary)) - #imaginary (f.* t (..with_sign imaginary +1.0))] - [#real t - #imaginary (f./ (f.* +2.0 t) - imaginary)]))) + t (|> input ..abs (f.+ (f.abs #real)) (f./ +2.0) (math.pow +0.5))] + (if (f.< +0.0 #real) + [..#real (f./ (f.* +2.0 t) + (f.abs #imaginary)) + ..#imaginary (f.* t (..with_sign #imaginary +1.0))] + [..#real t + ..#imaginary (f./ (f.* +2.0 t) + #imaginary)]))) (def: (root/2-1z input) (-> Complex Complex) @@ -248,18 +248,18 @@ (def: .public (reciprocal (^slots [#real #imaginary])) (-> Complex Complex) - (if (f.< (f.abs imaginary) - (f.abs real)) - (let [q (f./ imaginary real) - scale (f./ (|> real (f.* q) (f.+ imaginary)) + (if (f.< (f.abs #imaginary) + (f.abs #real)) + (let [q (f./ #imaginary #real) + scale (f./ (|> #real (f.* q) (f.+ #imaginary)) +1.0)] - [#real (f.* q scale) - #imaginary (f.opposite scale)]) - (let [q (f./ real imaginary) - scale (f./ (|> imaginary (f.* q) (f.+ real)) + [..#real (f.* q scale) + ..#imaginary (f.opposite scale)]) + (let [q (f./ #real #imaginary) + scale (f./ (|> #imaginary (f.* q) (f.+ #real)) +1.0)] - [#real scale - #imaginary (|> scale f.opposite (f.* q))]))) + [..#real scale + ..#imaginary (|> scale f.opposite (f.* q))]))) (def: .public (acos input) (-> Complex Complex) @@ -286,7 +286,7 @@ (def: .public (argument (^slots [#real #imaginary])) (-> Complex Frac) - (math.atan/2 real imaginary)) + (math.atan/2 #real #imaginary)) (def: .public (roots nth input) (-> Nat Complex (List Complex)) @@ -305,14 +305,14 @@ (math.cos inner)) imaginary (f.* nth_root_of_abs (math.sin inner))] - [#real real - #imaginary imaginary]))))))) + [..#real real + ..#imaginary imaginary]))))))) (def: .public (approximately? margin_of_error standard value) (-> Frac Complex Complex Bit) (and (f.approximately? margin_of_error - (value@ #..real standard) - (value@ #..real value)) + (value@ ..#real standard) + (value@ ..#real value)) (f.approximately? margin_of_error - (value@ #..imaginary standard) - (value@ #..imaginary value)))) + (value@ ..#imaginary standard) + (value@ ..#imaginary value)))) diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux index 230f18c1d..892274c28 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"}))) + {.#None} + {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))] @@ -398,8 +398,8 @@ (in [("lux text clip" 0 split_index mantissa) decimal])) - #.None - {#try.Failure ("lux text concat" <error> representation)}) + {.#None} + {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/i16.lux b/stdlib/source/library/lux/math/number/i16.lux index d16ebb6a3..b191de971 100644 --- a/stdlib/source/library/lux/math/number/i16.lux +++ b/stdlib/source/library/lux/math/number/i16.lux @@ -21,6 +21,6 @@ (I64 size))) (def: .public equivalence (Equivalence I16) (\ ..sub &equivalence)) -(def: .public width Nat (\ ..sub width)) +(def: .public width Nat (\ ..sub bits)) (def: .public i16 (-> I64 I16) (\ ..sub narrow)) (def: .public i64 (-> I16 I64) (\ ..sub wide)) diff --git a/stdlib/source/library/lux/math/number/i32.lux b/stdlib/source/library/lux/math/number/i32.lux index 9c71cfdff..8d0e7e2b3 100644 --- a/stdlib/source/library/lux/math/number/i32.lux +++ b/stdlib/source/library/lux/math/number/i32.lux @@ -21,6 +21,6 @@ (I64 size))) (def: .public equivalence (Equivalence I32) (\ ..sub &equivalence)) -(def: .public width Nat (\ ..sub width)) +(def: .public width Nat (\ ..sub bits)) (def: .public i32 (-> I64 I32) (\ ..sub narrow)) (def: .public i64 (-> I32 I64) (\ ..sub wide)) diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux index 8ccf4b8c8..cc36ed7c5 100644 --- a/stdlib/source/library/lux/math/number/i64.lux +++ b/stdlib/source/library/lux/math/number/i64.lux @@ -183,7 +183,7 @@ (: (Equivalence (I64 size)) &equivalence) (: Nat - width) + bits) (: (-> I64 (I64 size)) narrow) (: (-> (I64 size) I64) @@ -197,10 +197,10 @@ sign (..bit (-- width)) mantissa (..mask (-- width)) co_mantissa (..xor (.i64 -1) mantissa)] - {#.Some (: Sub + {.#Some (: Sub (implementation (def: &equivalence ..equivalence) - (def: width width) + (def: bits width) (def: (narrow value) (..or (|> value (..and ..sign) (..right_shifted sign_shift)) (|> value (..and mantissa)))) @@ -208,4 +208,4 @@ (.i64 (case (.nat (..and sign value)) 0 value _ (..or co_mantissa value))))))}) - #.None)) + {.#None})) diff --git a/stdlib/source/library/lux/math/number/i8.lux b/stdlib/source/library/lux/math/number/i8.lux index 6f6c77175..4f6695535 100644 --- a/stdlib/source/library/lux/math/number/i8.lux +++ b/stdlib/source/library/lux/math/number/i8.lux @@ -21,6 +21,6 @@ (I64 size))) (def: .public equivalence (Equivalence I8) (\ ..sub &equivalence)) -(def: .public width Nat (\ ..sub width)) +(def: .public width Nat (\ ..sub bits)) (def: .public i8 (-> I64 I8) (\ ..sub narrow)) (def: .public i64 (-> I8 I64) (\ ..sub wide)) diff --git a/stdlib/source/library/lux/math/number/int.lux b/stdlib/source/library/lux/math/number/int.lux index 5c4ff3cd6..9c91fa83b 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 0b0bf4105..428b8a68e 100644 --- a/stdlib/source/library/lux/math/number/nat.lux +++ b/stdlib/source/library/lux/math/number/nat.lux @@ -191,9 +191,9 @@ (def: (binary_value digit) (-> Nat (Maybe Nat)) (case digit - (^ (char "0")) {#.Some 0} - (^ (char "1")) {#.Some 1} - _ #.None)) + (^ (char "0")) {.#Some 0} + (^ (char "1")) {.#Some 1} + _ {.#None})) (def: (octal_character value) (-> Nat Text) @@ -211,15 +211,15 @@ (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} - _ #.None)) + (^ (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) (-> Nat Text) @@ -239,17 +239,17 @@ (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} - _ #.None)) + (^ (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) (-> Nat Text) @@ -276,15 +276,15 @@ (-> 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)) + _ {.#None})) (template [<shift> <struct> <to_character> <to_value> <error>] [(implementation: .public <struct> @@ -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,19 +345,19 @@ (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] (if (..< input_size idx) (case (decimal_value ("lux text char" idx repr)) - #.None + {.#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 be5bb235a..b7ef79ccb 100644 --- a/stdlib/source/library/lux/math/number/ratio.lux +++ b/stdlib/source/library/lux/math/number/ratio.lux @@ -30,19 +30,19 @@ (def: .public (nat value) (-> Ratio (Maybe Nat)) (case (value@ #denominator value) - 1 {#.Some (value@ #numerator value)} - _ #.None)) + 1 {.#Some (value@ #numerator value)} + _ {.#None})) (def: (normal (^slots [#numerator #denominator])) (-> Ratio Ratio) - (let [common (n.gcd numerator denominator)] - [#numerator (n./ common numerator) - #denominator (n./ common denominator)])) + (let [common (n.gcd #numerator #denominator)] + [..#numerator (n./ common #numerator) + ..#denominator (n./ common #denominator)])) (syntax: .public (ratio [numerator <code>.any ?denominator (<>.maybe <code>.any)]) - (in (list (` ((~! ..normal) [#..numerator (~ numerator) - #..denominator (~ (maybe.else (' 1) ?denominator))]))))) + (in (list (` ((~! ..normal) [..#numerator (~ numerator) + ..#denominator (~ (maybe.else (' 1) ?denominator))]))))) (def: .public (= parameter subject) (-> Ratio Ratio Bit) @@ -123,8 +123,8 @@ (def: .public (reciprocal (^slots [#numerator #denominator])) (-> Ratio Ratio) - [#numerator denominator - #denominator numerator]) + [..#numerator #denominator + ..#denominator #numerator]) (def: separator ":") @@ -132,19 +132,19 @@ (Codec Text Ratio) (def: (encoded (^slots [#numerator #denominator])) - ($_ text\composite (n\encoded numerator) ..separator (n\encoded denominator))) + ($_ text\composite (n\encoded #numerator) ..separator (n\encoded #denominator))) (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)] (in (normal [#numerator numerator #denominator denominator]))) - #.None - {#.Left (text\composite "Invalid syntax for ratio: " input)}))) + {.#None} + {.#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 a652d3913..9228d6a65 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>) @@ -357,18 +357,18 @@ (-> Text (Maybe Digits)) (let [length ("lux text size" input)] (if (//nat.> //i64.width length) - #.None + {.#None} (loop [idx 0 output (..digits [])] (if (//nat.< length idx) (case ("lux text index" 0 ("lux text clip" idx 1 input) "0123456789") - #.None - #.None + {.#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)})) + {.#None} + {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 b7dd727d7..6db4dc53f 100644 --- a/stdlib/source/library/lux/math/random.lux +++ b/stdlib/source/library/lux/math/random.lux @@ -91,10 +91,10 @@ (do ..monad [sample random] (case (check sample) - {#.Some output} + {.#Some output} (in output) - #.None + {.#None} (one check random)))) (def: .public (refined refiner gen) @@ -102,10 +102,10 @@ (do ..monad [sample gen] (case (refiner sample) - {#.Some refined} + {.#Some refined} (in refined) - #.None + {.#None} (refined refiner gen)))) (def: .public bit @@ -233,8 +233,8 @@ (if some? (do ! [value value_gen] - (in {#.Some value})) - (in #.None)))) + (in {.#Some value})) + (in {.#None})))) (def: .public (list size value_gen) (All (_ a) (-> Nat (Random a) (Random (List a)))) @@ -242,7 +242,7 @@ (do ..monad [x value_gen xs (list (-- size) value_gen)] - (in {#.Item x xs})) + (in {.#Item x xs})) (\ ..monad in (.list)))) (def: .public (row size value_gen) @@ -314,29 +314,29 @@ (def: .public month (Random Month) (let [(^open "\[0]") ..monad] - (..either (..either (..either (\in #month.January) - (..either (\in #month.February) - (\in #month.March))) - (..either (\in #month.April) - (..either (\in #month.May) - (\in #month.June)))) - (..either (..either (\in #month.July) - (..either (\in #month.August) - (\in #month.September))) - (..either (\in #month.October) - (..either (\in #month.November) - (\in #month.December))))))) + (..either (..either (..either (\in {month.#January}) + (..either (\in {month.#February}) + (\in {month.#March}))) + (..either (\in {month.#April}) + (..either (\in {month.#May}) + (\in {month.#June})))) + (..either (..either (\in {month.#July}) + (..either (\in {month.#August}) + (\in {month.#September}))) + (..either (\in {month.#October}) + (..either (\in {month.#November}) + (\in {month.#December}))))))) (def: .public day (Random Day) (let [(^open "\[0]") ..monad] - (..either (..either (\in #day.Sunday) - (..either (\in #day.Monday) - (\in #day.Tuesday))) - (..either (..either (\in #day.Wednesday) - (\in #day.Thursday)) - (..either (\in #day.Friday) - (\in #day.Saturday)))))) + (..either (..either (\in {day.#Sunday}) + (..either (\in {day.#Monday}) + (\in {day.#Tuesday}))) + (..either (..either (\in {day.#Wednesday}) + (\in {day.#Thursday})) + (..either (\in {day.#Friday}) + (\in {day.#Saturday})))))) (def: .public (result prng calc) (All (_ a) (-> PRNG (Random a) [PRNG a])) diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux index 433d76d91..dbd7924ce 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]} + (case (plist.value name (value@ .#modules lux)) + {.#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]} + (case (value@ .#current_module lux) + {.#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,13 +166,13 @@ [[module name] (..normal full_name)] (: (Meta (Maybe Macro)) (function (_ lux) - {#try.Success [lux + {try.#Success [lux (case (..current_module_name lux) - {#try.Failure error} - #.None + {try.#Failure error} + {.#None} - {#try.Success [_ this_module]} - (let [modules (value@ #.modules lux)] + {try.#Success [_ this_module]} + (let [modules (value@ .#modules lux)] (loop [module module name name] (do maybe.monad @@ -180,56 +180,56 @@ definition (: (Maybe Global) (|> $module (: Module) - (value@ #.definitions) + (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)} - #.None) + {.#Some (:as Macro def_value)} + {.#None}) - {#.Type [exported? type labels]} - #.None + {.#Type [exported? type labels]} + {.#None} - {#.Label _} - #.None + {.#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 + {.#None} #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})) + {.#None} (f x2) + {.#Some y} {.#Some y})) (def: (type_variable idx bindings) (-> Nat (List [Nat (Maybe Type)]) (Maybe Type)) (case bindings - #.End - #.None + {.#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]) + (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))) @@ -259,21 +259,21 @@ (case (do maybe.monad [scope (list.example (function (_ env) (or (list.any? test (: (List [Text [Type Any]]) - (value@ [#.locals #.mappings] env))) + (value@ [.#locals .#mappings] env))) (list.any? test (: (List [Text [Type Any]]) - (value@ [#.captured #.mappings] env))))) - (value@ #.scopes lux)) + (value@ [.#captured .#mappings] env))))) + (value@ .#scopes lux)) [_ [type _]] (on_either (list.example test) (: (List [Text [Type Any]]) - (value@ [#.locals #.mappings] scope)) + (value@ [.#locals .#mappings] scope)) (: (List [Text [Type Any]]) - (value@ [#.captured #.mappings] scope)))] + (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)})))) + {.#None} + {try.#Failure ($_ text\composite "Unknown variable: " name)})))) (def: without_lux_runtime (-> (List Text) (List Text)) @@ -299,54 +299,54 @@ (function (_ lux) (case (: (Maybe Global) (do maybe.monad - [(^slots [#.definitions]) (|> lux - (value@ #.modules) + [(^slots [.#definitions]) (|> lux + (value@ .#modules) (plist.value normal_module))] - (plist.value normal_short definitions))) - {#.Some definition} - {#try.Success [lux definition]} + (plist.value normal_short #definitions))) + {.#Some definition} + {try.#Success [lux definition]} _ - (let [current_module (|> lux (value@ #.current_module) (maybe.else "???")) + (let [current_module (|> lux (value@ .#current_module) (maybe.else "???")) all_known_modules (|> lux - (value@ #.modules) + (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} + (case (plist.value current_module (value@ .#modules lux)) + {.#Some this_module} (let [candidates (|> lux - (value@ #.modules) + (value@ .#modules) (list\each (function (_ [module_name module]) (|> module - (value@ #.definitions) + (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])} - #.None) + {.#Some (name\encoded [module_name def_name])} + {.#None}) - {#.Alias _} - #.None + {.#Alias _} + {.#None} - {#.Label _} - #.None + {.#Label _} + {.#None} - {#.Slot _} - #.None)))))) + {.#Slot _} + {.#None})))))) list.together (list.sorted text\<) (text.interposed ..listing_separator)) imports (|> this_module - (value@ #.imports) + (value@ .#imports) ..module_listing) aliases (|> this_module - (value@ #.module_aliases) + (value@ .#module_aliases) (list\each (function (_ [alias real]) ($_ text\composite alias " => " real))) (list.sorted text\<) (text.interposed ..listing_separator))] @@ -364,28 +364,28 @@ (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,44 +441,44 @@ (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) (-> Text (Meta (List [Text Global]))) (function (_ lux) - (case (plist.value module (value@ #.modules lux)) - #.None - {#try.Failure ($_ text\composite "Unknown module: " module)} + (case (plist.value module (value@ .#modules lux)) + {.#None} + {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} - #.None + {.#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 _} - #.None + {.#Label _} + {.#None} - {#.Slot _} - #.None))) + {.#Slot _} + {.#None}))) (..globals module))) (def: .public (exports module_name) @@ -495,57 +495,57 @@ (Meta (List [Text Module])) (function (_ lux) (|> lux - (value@ #.modules) + (value@ .#modules) [lux] - #try.Success))) + {try.#Success}))) (def: .public (tags_of type_name) (-> Name (Meta (Maybe (List Name)))) (do ..monad [.let [[module_name name] type_name] module (..module module_name)] - (case (plist.value name (value@ #.definitions module)) - {#.Some {#.Type [exported? type labels]}} + (case (plist.value name (value@ .#definitions module)) + {.#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)))) + (in {.#None})))) (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]} + (case (value@ .#expected lux) + {.#Some type} + {try.#Success [lux type]} - #.None - {#try.Failure "Not expecting any type."}))) + {.#None} + {try.#Failure "Not expecting any type."}))) (def: .public (imported_modules module_name) (-> Text (Meta (List Text))) (do ..monad - [(^slots [#.imports]) (..module module_name)] - (in imports))) + [(^slots [.#imports]) (..module module_name)] + (in #imports))) (def: .public (imported_by? import module) (-> Text Text (Meta Bit)) (do ..monad - [(^slots [#.imports]) (..module module)] - (in (list.any? (text\= import) imports)))) + [(^slots [.#imports]) (..module module)] + (in (list.any? (text\= import) #imports)))) (def: .public (imported? import) (-> Text (Meta Bit)) (\ ..functor each - (|>> (value@ #.imports) (list.any? (text\= import))) + (|>> (value@ .#imports) (list.any? (text\= import))) ..current_module)) (template [<name> <tag> <description>] @@ -555,8 +555,8 @@ [.let [[module name] tag_name] =module (..module module) this_module_name ..current_module_name] - (case (plist.value (text\composite "#" name) (value@ #.definitions =module)) - {#.Some {<tag> [exported? type group idx]}} + (case (plist.value name (value@ .#definitions =module)) + {.#Some {<tag> [exported? type group idx]}} (if (or (text\= this_module_name module) exported?) (in [idx (list\each (|>> [module]) group) type]) @@ -566,8 +566,8 @@ (..failure ($_ text\composite "Unknown " <description> ": " (name\encoded tag_name))))))] - [tag #.Label "tag"] - [slot #.Slot "slot"] + [tag .#Label "tag"] + [slot .#Slot "slot"] ) (def: .public (tag_lists module) @@ -577,33 +577,33 @@ 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})) + {.#Right slots} + {.#Item slots})) type]} - #.None) + {.#None}) _ - #.None)) - (value@ #.definitions =module))))) + {.#None})) + (value@ .#definitions =module))))) (def: .public locals (Meta (List (List [Text Type]))) (function (_ lux) - (case (list.inits (value@ #.scopes lux)) - #.None - {#try.Failure "No local environment"} + (case (list.inits (value@ .#scopes lux)) + {.#None} + {try.#Failure "No local environment"} - {#.Some scopes} - {#try.Success [lux - (list\each (|>> (value@ [#.locals #.mappings]) + {.#Some scopes} + {try.#Success [lux + (list\each (|>> (value@ [.#locals .#mappings]) (list\each (function (_ [name [type _]]) [name type]))) scopes)]}))) @@ -613,44 +613,44 @@ (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) (-> Type Code (Meta Any)) (do [! ..monad] - [eval (\ ! each (value@ #.eval) + [eval (\ ! each (value@ .#eval) ..compiler_state)] (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 3c797eda0..963c65712 100644 --- a/stdlib/source/library/lux/meta/location.lux +++ b/stdlib/source/library/lux/meta/location.lux @@ -8,28 +8,28 @@ (Equivalence Location) (def: (= reference subject) - (and ("lux text =" (value@ #.module reference) (value@ #.module subject)) - ("lux i64 =" (value@ #.line reference) (value@ #.line subject)) - ("lux i64 =" (value@ #.column reference) (value@ #.column subject))))) + (and ("lux text =" (value@ .#module reference) (value@ .#module subject)) + ("lux i64 =" (value@ .#line reference) (value@ .#line subject)) + ("lux i64 =" (value@ .#column reference) (value@ .#column subject))))) (def: .public dummy Location - [#.module "" - #.line 0 - #.column 0]) + [.#module "" + .#line 0 + .#column 0]) (macro: .public (here tokens compiler) (case tokens - #.End - (let [location (value@ #.location compiler)] - {#.Right [compiler + {.#End} + (let [location (value@ .#location 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 844da6654..f78141b02 100644 --- a/stdlib/source/library/lux/program.lux +++ b/stdlib/source/library/lux/program.lux @@ -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 253896c2f..77270308d 100644 --- a/stdlib/source/library/lux/target/common_lisp.lux +++ b/stdlib/source/library/lux/target/common_lisp.lux @@ -153,10 +153,10 @@ (def: .public (args& singles rest) (-> (List Var/1) Var/1 Var/*) (|> (case singles - #.End + {.#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> @@ -403,10 +403,10 @@ [(def: .public (<name> conditions expression) (-> (List Text) (Expression Any) (Expression Any)) (case conditions - #.End + {.#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 1519e639b..7f5d30f02 100644 --- a/stdlib/source/library/lux/target/js.lux +++ b/stdlib/source/library/lux/target/js.lux @@ -406,11 +406,12 @@ (text.interposed text.new_line)) text.new_line (case default - {#.Some default} + {.#Some default} (format "default:" (..nested (:representation default))) - #.None "")) + {.#None} + "")) :abstraction ..block)))) ) diff --git a/stdlib/source/library/lux/target/jvm.lux b/stdlib/source/library/lux/target/jvm.lux index 0d07ab2aa..4e04312ff 100644 --- a/stdlib/source/library/lux/target/jvm.lux +++ b/stdlib/source/library/lux/target/jvm.lux @@ -24,63 +24,63 @@ {#SIPUSH Int} - #ICONST_M1 - #ICONST_0 - #ICONST_1 - #ICONST_2 - #ICONST_3 - #ICONST_4 - #ICONST_5 - - #LCONST_0 - #LCONST_1 + {#ICONST_M1} + {#ICONST_0} + {#ICONST_1} + {#ICONST_2} + {#ICONST_3} + {#ICONST_4} + {#ICONST_5} + + {#LCONST_0} + {#LCONST_1} - #FCONST_0 - #FCONST_1 - #FCONST_2 + {#FCONST_0} + {#FCONST_1} + {#FCONST_2} - #DCONST_0 - #DCONST_1 + {#DCONST_0} + {#DCONST_1} - #ACONST_NULL + {#ACONST_NULL} {#LDC Literal})) (type: .public Int_Arithmetic (Variant - #IADD - #ISUB - #IMUL - #IDIV - #IREM - #INEG)) + {#IADD} + {#ISUB} + {#IMUL} + {#IDIV} + {#IREM} + {#INEG})) (type: .public Long_Arithmetic (Variant - #LADD - #LSUB - #LMUL - #LDIV - #LREM - #LNEG)) + {#LADD} + {#LSUB} + {#LMUL} + {#LDIV} + {#LREM} + {#LNEG})) (type: .public Float_Arithmetic (Variant - #FADD - #FSUB - #FMUL - #FDIV - #FREM - #FNEG)) + {#FADD} + {#FSUB} + {#FMUL} + {#FDIV} + {#FREM} + {#FNEG})) (type: .public Double_Arithmetic (Variant - #DADD - #DSUB - #DMUL - #DDIV - #DREM - #DNEG)) + {#DADD} + {#DSUB} + {#DMUL} + {#DDIV} + {#DREM} + {#DNEG})) (type: .public Arithmetic (Variant @@ -91,21 +91,21 @@ (type: .public Int_Bitwise (Variant - #IOR - #IXOR - #IAND - #ISHL - #ISHR - #IUSHR)) + {#IOR} + {#IXOR} + {#IAND} + {#ISHL} + {#ISHR} + {#IUSHR})) (type: .public Long_Bitwise (Variant - #LOR - #LXOR - #LAND - #LSHL - #LSHR - #LUSHR)) + {#LOR} + {#LXOR} + {#LAND} + {#LSHL} + {#LSHR} + {#LUSHR})) (type: .public Bitwise (Variant @@ -114,55 +114,55 @@ (type: .public Conversion (Variant - #I2B - #I2S - #I2L - #I2F - #I2D - #I2C - - #L2I - #L2F - #L2D - - #F2I - #F2L - #F2D + {#I2B} + {#I2S} + {#I2L} + {#I2F} + {#I2D} + {#I2C} + + {#L2I} + {#L2F} + {#L2D} + + {#F2I} + {#F2L} + {#F2D} - #D2I - #D2L - #D2F)) + {#D2I} + {#D2L} + {#D2F})) (type: .public Array (Variant - #ARRAYLENGTH + {#ARRAYLENGTH} {#NEWARRAY (Type Primitive)} {#ANEWARRAY (Type category.Object)} - #BALOAD - #BASTORE + {#BALOAD} + {#BASTORE} - #SALOAD - #SASTORE + {#SALOAD} + {#SASTORE} - #IALOAD - #IASTORE + {#IALOAD} + {#IASTORE} - #LALOAD - #LASTORE + {#LALOAD} + {#LASTORE} - #FALOAD - #FASTORE + {#FALOAD} + {#FASTORE} - #DALOAD - #DASTORE + {#DALOAD} + {#DASTORE} - #CALOAD - #CASTORE + {#CALOAD} + {#CASTORE} - #AALOAD - #AASTORE)) + {#AALOAD} + {#AASTORE})) (type: .public Object (Variant @@ -221,25 +221,25 @@ (type: .public Stack (Variant - #DUP - #DUP_X1 - #DUP_X2 - #DUP2 - #DUP2_X1 - #DUP2_X2 - #SWAP - #POP - #POP2)) + {#DUP} + {#DUP_X1} + {#DUP_X2} + {#DUP2} + {#DUP2_X1} + {#DUP2_X2} + {#SWAP} + {#POP} + {#POP2})) (type: .public Comparison (Variant - #LCMP + {#LCMP} - #FCMPG - #FCMPL + {#FCMPG} + {#FCMPL} - #DCMPG - #DCMPL)) + {#DCMPG} + {#DCMPL})) (type: .public Label Nat) @@ -270,21 +270,21 @@ (type: .public (Exception label) (Variant {#Try label label label (Type Class)} - #ATHROW)) + {#ATHROW})) (type: .public Concurrency (Variant - #MONITORENTER - #MONITOREXIT)) + {#MONITORENTER} + {#MONITOREXIT})) (type: .public Return (Variant - #RETURN - #IRETURN - #LRETURN - #FRETURN - #DRETURN - #ARETURN)) + {#RETURN} + {#IRETURN} + {#LRETURN} + {#FRETURN} + {#DRETURN} + {#ARETURN})) (type: .public (Control label) (Variant @@ -296,7 +296,7 @@ (type: .public (Instruction embedded label) (Variant - #NOP + {#NOP} {#Constant Constant} {#Arithmetic Arithmetic} {#Bitwise Bitwise} diff --git a/stdlib/source/library/lux/target/jvm/attribute.lux b/stdlib/source/library/lux/target/jvm/attribute.lux index ed10a42c6..bf99e9f2e 100644 --- a/stdlib/source/library/lux/target/jvm/attribute.lux +++ b/stdlib/source/library/lux/target/jvm/attribute.lux @@ -84,7 +84,8 @@ (^template [<tag>] [{<tag> [name length info]} (|> length //unsigned.value (n.+ ..common_attribute_length))]) - ([#Constant] [#Code]))) + ([#Constant] + [#Code]))) ... TODO: Inline ASAP (def: (constant' @name index) diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux index d999f5320..daf475a97 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,7 +106,7 @@ (def: .public new_label (Bytecode Label) (function (_ [pool environment tracker]) - {#try.Success [[pool + {try.#Success [[pool environment (revised@ #next ++ tracker)] [..relative_identity @@ -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,18 +140,18 @@ (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>) - #.None + {.#None} (do try.monad [[actual environment] (/environment.continue (|> environment - (value@ #/environment.stack) + (value@ /environment.#stack) (maybe.else /stack.empty)) environment)] <success>)))))) @@ -167,7 +167,7 @@ (def: .public failure (-> Text Bytecode) - (|>> #try.Failure function.constant)) + (|>> {try.#Failure} function.constant)) (def: .public (except exception value) (All (_ e) (-> (exception.Exception e) e Bytecode)) @@ -201,7 +201,8 @@ []]])))) (template [<name> <frames>] - [(def: <name> U2 (|> <frames> //unsigned.u2 try.trusted))] + [(def: <name> U2 + (|> <frames> //unsigned.u2 try.trusted))] [$0 0] [$1 1] @@ -455,10 +456,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 +481,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 +503,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 +584,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>] @@ -705,8 +706,8 @@ +1) jump)))] (if big? - (\ ! each (|>> #.Left) (//signed.s4 jump)) - (\ ! each (|>> #.Right) (//signed.s2 jump)))))) + (\ ! each (|>> {.#Left}) (//signed.s4 jump)) + (\ ! each (|>> {.#Right}) (//signed.s2 jump)))))) (exception: .public (unset_label [label Label]) (exception.report @@ -715,23 +716,23 @@ (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 + {.#None} (exception.except ..unknown_label [label]))) (def: (acknowledge_label stack label tracker) (-> Stack Label Tracker Tracker) (case (dictionary.value label (value@ #known tracker)) - {#.Some _} + {.#Some _} tracker - #.None - (revised@ #known (dictionary.has label [stack #.None]) tracker))) + {.#None} + (revised@ #known (dictionary.has label [stack {.#None}]) tracker))) (template [<consumption> <name> <instruction>] [(def: .public (<name> label) @@ -757,10 +758,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,22 +803,22 @@ (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 + {.#None} (exception.except ..unknown_label [label]))) []]]))))))] @@ -832,10 +833,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 +866,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)) @@ -873,7 +874,7 @@ @afterwards)] (in [..no_exceptions (bytecode minimum >default [>at_minimum >afterwards])])) - #.None + {.#None} (exception.except ..invalid_tableswitch [])))) []]])))))) @@ -907,7 +908,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 @@ -915,7 +916,7 @@ (\ ! each (|>> (list.zipped/2 (list\each product.left cases)))))] (in [..no_exceptions (bytecode >default >cases)])) - #.None + {.#None} (exception.except ..invalid_lookupswitch [])))) []]])))))) @@ -976,8 +977,8 @@ (do ..monad [index (<| ..lifted (<method> (..reflection class)) - [#//constant/pool.name method - #//constant/pool.descriptor (type.descriptor type)]) + [//constant/pool.#name method + //constant/pool.#descriptor (type.descriptor type)]) .let [consumption (|> inputs (list\each ..type_size) (list\mix n.+ (if <static?> 0 1)) @@ -1001,8 +1002,8 @@ (do ..monad [index (<| ..lifted (//constant/pool.field (..reflection class)) - [#//constant/pool.name field - #//constant/pool.descriptor (type.descriptor type)])] + [//constant/pool.#name field + //constant/pool.#descriptor (type.descriptor type)])] (if (or (same? type.long type) (same? type.double type)) (..bytecode <consumption> $2 @_ <2> [index]) @@ -1025,7 +1026,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)] @@ -1037,10 +1038,10 @@ (in []) (exception.except ..invalid_range_for_try [@start @end])) [_ @handler] (..resolve_label @handler resolver)] - (in [(row.row [#//exception.start @start - #//exception.end @end - #//exception.handler @handler - #//exception.catch @catch]) + (in [(row.row [//exception.#start @start + //exception.#end @end + //exception.#handler @handler + //exception.#catch @catch]) _.empty]))) []]]}))) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux index c7b6481fb..5583757a7 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] @@ -40,7 +40,8 @@ (implementation: .public monoid (Monoid Condition) - (def: identity (|>> #try.Success)) + (def: identity + (|>> {try.#Success})) (def: (composite left right) (function (_ environment) @@ -52,16 +53,16 @@ (def: .public (stack environment) (-> Environment (Try Stack)) - (case (value@ #..stack environment) - {#.Some stack} - {#try.Success stack} + (case (value@ ..#stack environment) + {.#Some stack} + {try.#Success stack} - #.None + {.#None} (exception.except ..discontinuity []))) (def: .public discontinue (-> Environment Environment) - (with@ #..stack #.None)) + (with@ ..#stack {.#None})) (exception: .public (mismatched_stacks [expected Stack actual Stack]) @@ -71,14 +72,14 @@ (def: .public (continue expected environment) (-> Stack Environment (Try [Stack Environment])) - (case (value@ #..stack environment) - {#.Some actual} + (case (value@ ..#stack environment) + {.#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)]})) + {.#None} + {try.#Success [expected (with@ ..#stack {.#Some expected} environment)]})) (def: .public (consumes amount) (-> U2 Condition) @@ -88,7 +89,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) @@ -97,13 +98,13 @@ [previous (..stack environment) current (/stack.push amount previous) .let [limit (|> environment - (value@ [#..limit #/limit.stack]) + (value@ [..#limit /limit.#stack]) (/stack.max current))]] (in (|> environment - (with@ #..stack {#.Some current}) - (with@ [#..limit #/limit.stack] limit)))))) + (with@ ..#stack {.#Some current}) + (with@ [..#limit /limit.#stack] limit)))))) (def: .public (has registry) (-> Registry Condition) - (|>> (revised@ [#..limit #/limit.registry] (/registry.has registry)) - #try.Success)) + (|>> (revised@ [..#limit /limit.#registry] (/registry.has registry)) + {try.#Success})) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux index c43e5ed0b..85f97d48f 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux @@ -635,12 +635,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 + {.#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) @@ -696,10 +696,10 @@ (loop [offset (n.+ (///unsigned.value ..integer_size) offset) cases cases] (case cases - #.End + {.#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/pool.lux b/stdlib/source/library/lux/target/jvm/constant/pool.lux index 41ff5ad26..dc60b3c55 100644 --- a/stdlib/source/library/lux/target/jvm/constant/pool.lux +++ b/stdlib/source/library/lux/target/jvm/constant/pool.lux @@ -57,18 +57,18 @@ (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}] (if (\ <equivalence> = reference <value>') - {#try.Success [[current pool] + {try.#Success [[current pool] index]} <try_again>) _ <try_again>) - {#try.Failure _} + {try.#Failure _} (let [new {<tag> <value>'}] (do [! try.monad] [@new (//unsigned.u2 (//.size new)) @@ -92,11 +92,11 @@ (Adder <type>) (!add <tag> <equivalence> value))] - [integer Integer #//.Integer (//.value_equivalence i32.equivalence)] - [float Float #//.Float (//.value_equivalence //.float_equivalence)] - [long Long #//.Long (//.value_equivalence int.equivalence)] - [double Double #//.Double (//.value_equivalence frac.equivalence)] - [utf8 UTF8 #//.UTF8 text.equivalence] + [integer Integer //.#Integer (//.value_equivalence i32.equivalence)] + [float Float //.#Float (//.value_equivalence //.float_equivalence)] + [long Long //.#Long (//.value_equivalence int.equivalence)] + [double Double //.#Double (//.value_equivalence frac.equivalence)] + [utf8 UTF8 //.#UTF8 text.equivalence] ) (def: .public (string value) @@ -104,21 +104,21 @@ (do ..monad [@value (utf8 value) .let [value (//.string @value)]] - (!add #//.String (//.value_equivalence //index.equivalence) value))) + (!add //.#String (//.value_equivalence //index.equivalence) value))) (def: .public (class name) (-> Internal (Resource (Index Class))) (do ..monad [@name (utf8 (//name.read name)) .let [value (//.class @name)]] - (!add #//.Class //.class_equivalence value))) + (!add //.#Class //.class_equivalence value))) (def: .public (descriptor value) (All (_ kind) (-> (Descriptor kind) (Resource (Index (Descriptor kind))))) (let [value (//descriptor.descriptor value)] - (!add #//.UTF8 text.equivalence value))) + (!add //.#UTF8 text.equivalence value))) (type: .public (Member of) (Record @@ -131,7 +131,7 @@ (do ..monad [@name (utf8 name) @descriptor (..descriptor descriptor)] - (!add #//.Name_And_Type //.name_and_type_equivalence [#//.name @name #//.descriptor @descriptor]))) + (!add //.#Name_And_Type //.name_and_type_equivalence [//.#name @name //.#descriptor @descriptor]))) (template [<name> <tag> <of>] [(def: .public (<name> class member) @@ -139,11 +139,11 @@ (do ..monad [@class (..class (//name.internal class)) @name_and_type (name_and_type member)] - (!add <tag> //.reference_equivalence [#//.class @class #//.name_and_type @name_and_type])))] + (!add <tag> //.reference_equivalence [//.#class @class //.#name_and_type @name_and_type])))] - [field #//.Field Value] - [method #//.Method Method] - [interface_method #//.Interface_Method Method] + [field //.#Field Value] + [method //.#Method Method] + [interface_method //.#Interface_Method Method] ) (def: .public writer diff --git a/stdlib/source/library/lux/target/jvm/encoding/signed.lux b/stdlib/source/library/lux/target/jvm/encoding/signed.lux index 1e7e57721..5135e4a76 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 804374a4e..1138d61ad 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 82999be00..00b26447d 100644 --- a/stdlib/source/library/lux/target/jvm/loader.lux +++ b/stdlib/source/library/lux/target/jvm/loader.lux @@ -116,15 +116,15 @@ (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 + {.#None} (panic! (exception.error ..unknown [class_name]))))))))) (def: .public (store name bytecode library) @@ -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 a56b732c3..25338a20a 100644 --- a/stdlib/source/library/lux/target/jvm/method.lux +++ b/stdlib/source/library/lux/target/jvm/method.lux @@ -59,25 +59,25 @@ (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) - #//attribute/code.code bytecode - #//attribute/code.exception_table exceptions - #//attribute/code.attributes (row.row)])] + @code (//attribute.code [//attribute/code.#limit (value@ //bytecode/environment.#limit environment) + //attribute/code.#code bytecode + //attribute/code.#exception_table exceptions + //attribute/code.#attributes (row.row)])] (in (row.suffix @code attributes))) - #.None + {.#None} (in attributes))] (in [#modifier modifier #name @name diff --git a/stdlib/source/library/lux/target/jvm/reflection.lux b/stdlib/source/library/lux/target/jvm/reflection.lux index 59a3d72d6..6c4467ae7 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,17 +164,17 @@ [/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 - (array.list #.None) + (array.list {.#None}) (monad.each ! parameter))] (in (/.class (|> raw (:as (java/lang/Class java/lang/Object)) @@ -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,16 +260,16 @@ (-> 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 + {.#None} <else>))) (exception: .public (cannot_correspond [class (java/lang/Class java/lang/Object) @@ -295,9 +295,9 @@ (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)) + class_params (array.list {.#None} (java/lang/Class::getTypeParameters class)) num_class_params (list.size class_params) num_type_params (list.size params)] (if (text\= class_name name) @@ -308,19 +308,19 @@ (list\mix (function (_ [name paramT] mapping) (dictionary.has name paramT mapping)) /lux.fresh) - #try.Success) + {try.#Success}) (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 + {.#None} (exception.except ..non_jvm_type [type])) _ @@ -349,18 +349,18 @@ (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? (-> (array.Array java/lang/annotation/Annotation) Bit) - (|>> (array.list #.None) + (|>> (array.list {.#None}) (list.all (|>> (ffi.check java/lang/Deprecated))) list.empty? not)) diff --git a/stdlib/source/library/lux/target/jvm/type.lux b/stdlib/source/library/lux/target/jvm/type.lux index 3a3235a7c..9042ebb03 100644 --- a/stdlib/source/library/lux/target/jvm/type.lux +++ b/stdlib/source/library/lux/target/jvm/type.lux @@ -177,8 +177,8 @@ [..float] [..double] [..char])))) - (|> type (:as (Type Primitive)) #.Right) - (|> type (:as (Type Object)) #.Left))) + (|> type (:as (Type Primitive)) {.#Right}) + (|> type (:as (Type Object)) {.#Left}))) (def: .public (void? type) (-> (Type Return) (Either (Type Value) @@ -187,8 +187,8 @@ [(\ ..equivalence = (: (Type Return) <type>) type)] [..void])))) - (|> type (:as (Type Void)) #.Right) - (|> type (:as (Type Value)) #.Left))) + (|> type (:as (Type Void)) {.#Right}) + (|> type (:as (Type Value)) {.#Left}))) ) (def: .public (class? type) @@ -204,7 +204,7 @@ (|> repr (text.clip prefix_size name_size) (\ maybe.monad each (|>> //name.internal //name.external)))) - #.None))) + {.#None}))) (def: .public format (All (_ a) (Format (Type a))) diff --git a/stdlib/source/library/lux/target/jvm/type/lux.lux b/stdlib/source/library/lux/target/jvm/type/lux.lux index ee5734d6d..7aeeea7d9 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] @@ -120,10 +120,10 @@ (do <>.monad [var //parser.var'] (in (case (dictionary.value var mapping) - #.None + {.#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/jvm/type/signature.lux b/stdlib/source/library/lux/target/jvm/type/signature.lux index b0a2c0303..e263d6c6a 100644 --- a/stdlib/source/library/lux/target/jvm/type/signature.lux +++ b/stdlib/source/library/lux/target/jvm/type/signature.lux @@ -90,7 +90,7 @@ (format //descriptor.class_prefix (|> name ///name.internal ///name.read) (case parameters - #.End + {.#End} "" _ @@ -127,7 +127,7 @@ (Signature Method)) (:abstraction (format (case type_variables - #.End + {.#End} "" _ (|> type_variables diff --git a/stdlib/source/library/lux/target/php.lux b/stdlib/source/library/lux/target/php.lux index 79272dd3e..97fa1edf4 100644 --- a/stdlib/source/library/lux/target/php.lux +++ b/stdlib/source/library/lux/target/php.lux @@ -215,7 +215,7 @@ (def: .public (closure uses arguments body!) (-> (List Argument) (List Argument) Statement Literal) (let [uses (case uses - #.End + {.#End} "" _ diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux index 1a9796a44..8b2c5e6bb 100644 --- a/stdlib/source/library/lux/target/python.lux +++ b/stdlib/source/library/lux/target/python.lux @@ -371,11 +371,11 @@ (format "while " (:representation test) ":" (..nested (:representation body!)) (case else! - {#.Some else!} + {.#Some else!} (format text.new_line "else:" (..nested (:representation else!))) - #.None + {.#None} "")))) (def: .public (for_in var inputs body!) @@ -424,10 +424,10 @@ (def: .public (exec code globals) (-> (Expression Any) (Maybe (Expression Any)) (Statement Any)) (let [extra (case globals - {#.Some globals} + {.#Some globals} (.list globals) - #.None + {.#None} (.list))] (:abstraction (format "exec" (:representation (..tuple (list& code extra))))))) diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux index f4f967335..8653d5203 100644 --- a/stdlib/source/library/lux/target/ruby.lux +++ b/stdlib/source/library/lux/target/ruby.lux @@ -370,10 +370,10 @@ (text.enclosed ["{" "}"]) (format "lambda "))] (|> (case name - #.None + {.#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 692e903bc..0e6dda75a 100644 --- a/stdlib/source/library/lux/target/scheme.lux +++ b/stdlib/source/library/lux/target/scheme.lux @@ -76,9 +76,9 @@ (def: (arguments [mandatory rest]) (-> Arguments (Code Any)) (case rest - {#.Some rest} + {.#Some rest} (case mandatory - #.End + {.#End} rest _ @@ -89,7 +89,7 @@ (text.enclosed ["(" ")"]) :abstraction)) - #.None + {.#None} (|> mandatory (list\each ..code) (text.interposed " ") @@ -156,20 +156,20 @@ (def: form (-> (List (Code Any)) Code) (.let [nested_new_line (format text.new_line text.tab)] - (|>> (case> #.End + (|>> (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) @@ -368,10 +368,10 @@ (-> Var (List [Expression Expression]) (Maybe Expression) Expression Computation) (..form (list (..var "guard") (..form (|> (case else - #.None + {.#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 6aebcaadc..ea228316a 100644 --- a/stdlib/source/library/lux/test.lux +++ b/stdlib/source/library/lux/test.lux @@ -306,10 +306,10 @@ (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 + {.#None} (set.has [module remaining] output)))) (template [<macro> <function>] @@ -353,9 +353,9 @@ .let [coverage (|> definitions (list\mix (function (_ [short [exported? _]] aggregate) (if exported? - {#.Item short aggregate} + {.#Item short aggregate} aggregate)) - #.End) + {.#End}) ..encoded_coverage)]] (in (list (` ((~! ..covering') (~ (code.text module)) @@ -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 743516d24..6747215d7 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 @@ -201,10 +201,10 @@ (-> Time Text) (let [(^slots [#hour #minute #second #milli_second]) (..clock time)] ($_ text\composite - (..padded hour) - ..separator (..padded minute) - ..separator (..padded second) - (..millis_format milli_second)))) + (..padded #hour) + ..separator (..padded #minute) + ..separator (..padded #second) + (..millis_format #milli_second)))) (implementation: .public codec (Codec Text Time) diff --git a/stdlib/source/library/lux/time/date.lux b/stdlib/source/library/lux/time/date.lux index 52742572d..fa5af30dc 100644 --- a/stdlib/source/library/lux/time/date.lux +++ b/stdlib/source/library/lux/time/date.lux @@ -79,7 +79,7 @@ (-> 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 @@ -89,7 +89,7 @@ Date (try.trusted (..date //year.epoch - #//month.January + {//month.#January} ..minimum_day))) (template [<name> <type> <field>] @@ -223,8 +223,8 @@ (n.* //year.days) (n.+ leaps::70)) ... The epoch is being calculated from March 1st, instead of January 1st. - january_&_february (n.+ (//month.days #//month.January) - (//month.days #//month.February))] + january_&_february (n.+ (//month.days {//month.#January}) + (//month.days {//month.#February}))] (|> 0 ... 1600/01/01 (n.+ (n.* 4 days_per_era)) diff --git a/stdlib/source/library/lux/time/day.lux b/stdlib/source/library/lux/time/day.lux index aee0a9f33..6bdbba5b2 100644 --- a/stdlib/source/library/lux/time/day.lux +++ b/stdlib/source/library/lux/time/day.lux @@ -11,7 +11,7 @@ ["[0]" try {"+" [Try]}] ["[0]" exception {"+" [exception:]}]] [data - ["[0]" text]] + ["[0]" text ("[1]#[0]" monoid)]] [macro ["[0]" template]] [math @@ -20,13 +20,13 @@ (type: .public Day (Variant - #Sunday - #Monday - #Tuesday - #Wednesday - #Thursday - #Friday - #Saturday)) + {#Sunday} + {#Monday} + {#Tuesday} + {#Wednesday} + {#Thursday} + {#Friday} + {#Saturday})) (implementation: .public equivalence (Equivalence Day) @@ -34,7 +34,7 @@ (def: (= reference sample) (case [reference sample] (^template [<tag>] - [[<tag> <tag>] + [[{<tag>} {<tag>}] #1]) ([#Sunday] [#Monday] @@ -50,13 +50,13 @@ (def: (nat day) (-> Day Nat) (case day - #Sunday 0 - #Monday 1 - #Tuesday 2 - #Wednesday 3 - #Thursday 4 - #Friday 5 - #Saturday 6)) + {#Sunday} 0 + {#Monday} 1 + {#Tuesday} 2 + {#Wednesday} 3 + {#Thursday} 4 + {#Friday} 5 + {#Saturday} 6)) (implementation: .public order (Order Day) @@ -73,23 +73,23 @@ (def: (succ day) (case day - #Sunday #Monday - #Monday #Tuesday - #Tuesday #Wednesday - #Wednesday #Thursday - #Thursday #Friday - #Friday #Saturday - #Saturday #Sunday)) + {#Sunday} {#Monday} + {#Monday} {#Tuesday} + {#Tuesday} {#Wednesday} + {#Wednesday} {#Thursday} + {#Thursday} {#Friday} + {#Friday} {#Saturday} + {#Saturday} {#Sunday})) (def: (pred day) (case day - #Monday #Sunday - #Tuesday #Monday - #Wednesday #Tuesday - #Thursday #Wednesday - #Friday #Thursday - #Saturday #Friday - #Sunday #Saturday))) + {#Monday} {#Sunday} + {#Tuesday} {#Monday} + {#Wednesday} {#Tuesday} + {#Thursday} {#Wednesday} + {#Friday} {#Thursday} + {#Saturday} {#Friday} + {#Sunday} {#Saturday}))) (exception: .public (not_a_day_of_the_week [value Text]) (exception.report @@ -101,36 +101,38 @@ (def: (encoded value) (case value (^template [<tag>] - [<tag> (template.text [<tag>])]) - ([#..Monday] - [#..Tuesday] - [#..Wednesday] - [#..Thursday] - [#..Friday] - [#..Saturday] - [#..Sunday]))) + [{<tag>} + (text.replaced "#" "" (template.text [<tag>]))]) + ([..#Monday] + [..#Tuesday] + [..#Wednesday] + [..#Thursday] + [..#Friday] + [..#Saturday] + [..#Sunday]))) (def: (decoded value) - (case value + (case (text#composite "#" value) (^template [<tag>] - [(^ (template.text [<tag>])) {#try.Success <tag>}]) - ([#..Monday] - [#..Tuesday] - [#..Wednesday] - [#..Thursday] - [#..Friday] - [#..Saturday] - [#..Sunday]) + [(^ (template.text [<tag>])) + {try.#Success {<tag>}}]) + ([..#Monday] + [..#Tuesday] + [..#Wednesday] + [..#Thursday] + [..#Friday] + [..#Saturday] + [..#Sunday]) _ (exception.except ..not_a_day_of_the_week [value])))) (def: .public week (List Day) - (list #Sunday - #Monday - #Tuesday - #Wednesday - #Thursday - #Friday - #Saturday)) + (list {#Sunday} + {#Monday} + {#Tuesday} + {#Wednesday} + {#Thursday} + {#Friday} + {#Saturday})) (with_expansions [<pairs> (as_is [01 #Sunday] [02 #Monday] @@ -143,24 +145,28 @@ (-> Day Nat) (case day (^template [<number> <day>] - [<day> <number>]) + [{<day>} + <number>]) (<pairs>))) (exception: .public (invalid_day [number Nat]) (exception.report ["Number" (\ n.decimal encoded number)] ["Valid range" ($_ "lux text concat" - (\ n.decimal encoded (..number #Sunday)) + (\ n.decimal encoded (..number {#Sunday})) " ~ " - (\ n.decimal encoded (..number #Saturday)))])) + (\ n.decimal encoded (..number {#Saturday})))])) (def: .public (by_number number) (-> Nat (Try Day)) (case number (^template [<number> <day>] - [<number> {#try.Success <day>}]) + [<number> + {try.#Success {<day>}}]) (<pairs>) - _ (exception.except ..invalid_day [number]))) + + _ + (exception.except ..invalid_day [number]))) ) (implementation: .public hash @@ -170,7 +176,7 @@ (def: (hash day) (case day (^template [<prime> <day>] - [<day> + [{<day>} <prime>]) ([02 #Sunday] [03 #Monday] diff --git a/stdlib/source/library/lux/time/duration.lux b/stdlib/source/library/lux/time/duration.lux index fd4a728f2..94b73e791 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/instant.lux b/stdlib/source/library/lux/time/instant.lux index d5ffcdb7e..5fb300424 100644 --- a/stdlib/source/library/lux/time/instant.lux +++ b/stdlib/source/library/lux/time/instant.lux @@ -216,13 +216,13 @@ (i.+ days) (i.% +7) ... This is done to turn negative days into positive days. (i.+ +7) (i.% +7)) - +0 #day.Sunday - +1 #day.Monday - +2 #day.Tuesday - +3 #day.Wednesday - +4 #day.Thursday - +5 #day.Friday - +6 #day.Saturday + +0 {day.#Sunday} + +1 {day.#Monday} + +2 {day.#Tuesday} + +3 {day.#Wednesday} + +4 {day.#Thursday} + +5 {day.#Friday} + +6 {day.#Saturday} _ (undefined)))) (def: .public (of_date_time date time) diff --git a/stdlib/source/library/lux/time/month.lux b/stdlib/source/library/lux/time/month.lux index e2936b80e..0717ed1b9 100644 --- a/stdlib/source/library/lux/time/month.lux +++ b/stdlib/source/library/lux/time/month.lux @@ -11,7 +11,7 @@ ["[0]" try {"+" [Try]}] ["[0]" exception {"+" [exception:]}]] [data - ["[0]" text]] + ["[0]" text ("[1]#[0]" monoid)]] [macro ["[0]" template]] [math @@ -20,18 +20,18 @@ (type: .public Month (Variant - #January - #February - #March - #April - #May - #June - #July - #August - #September - #October - #November - #December)) + {#January} + {#February} + {#March} + {#April} + {#May} + {#June} + {#July} + {#August} + {#September} + {#October} + {#November} + {#December})) (implementation: .public equivalence (Equivalence Month) @@ -39,7 +39,7 @@ (def: (= reference sample) (case [reference sample] (^template [<tag>] - [[<tag> <tag>] + [[{<tag>} {<tag>}] true]) ([#January] [#February] @@ -73,24 +73,28 @@ (-> Month Nat) (case month (^template [<number> <month>] - [<month> <number>]) + [{<month>} + <number>]) (<pairs>))) (exception: .public (invalid_month [number Nat]) (exception.report ["Number" (\ n.decimal encoded number)] ["Valid range" ($_ "lux text concat" - (\ n.decimal encoded (..number #January)) + (\ n.decimal encoded (..number {#January})) " ~ " - (\ n.decimal encoded (..number #December)))])) + (\ n.decimal encoded (..number {#December})))])) (def: .public (by_number number) (-> Nat (Try Month)) (case number (^template [<number> <month>] - [<number> {#try.Success <month>}]) + [<number> + {try.#Success {<month>}}]) (<pairs>) - _ (exception.except ..invalid_month [number]))) + + _ + (exception.except ..invalid_month [number]))) ) (implementation: .public hash @@ -100,7 +104,7 @@ (def: (hash month) (case month (^template [<prime> <month>] - [<month> + [{<month>} <prime>]) ([02 #January] [03 #February] @@ -121,7 +125,8 @@ (def: &equivalence ..equivalence) (def: (< reference sample) - (n.< (..number reference) (..number sample)))) + (n.< (..number reference) + (..number sample)))) (implementation: .public enum (Enum Month) @@ -130,39 +135,40 @@ (def: (succ month) (case month - #January #February - #February #March - #March #April - #April #May - #May #June - #June #July - #July #August - #August #September - #September #October - #October #November - #November #December - #December #January)) + {#January} {#February} + {#February} {#March} + {#March} {#April} + {#April} {#May} + {#May} {#June} + {#June} {#July} + {#July} {#August} + {#August} {#September} + {#September} {#October} + {#October} {#November} + {#November} {#December} + {#December} {#January})) (def: (pred month) (case month - #February #January - #March #February - #April #March - #May #April - #June #May - #July #June - #August #July - #September #August - #October #September - #November #October - #December #November - #January #December))) + {#February} {#January} + {#March} {#February} + {#April} {#March} + {#May} {#April} + {#June} {#May} + {#July} {#June} + {#August} {#July} + {#September} {#August} + {#October} {#September} + {#November} {#October} + {#December} {#November} + {#January} {#December}))) (def: .public (days month) (-> Month Nat) (case month (^template [<days> <month>] - [<month> <days>]) + [{<month>} + <days>]) ([31 #January] [28 #February] [31 #March] @@ -182,23 +188,23 @@ (def: .public (leap_year_days month) (-> Month Nat) (case month - #February (++ (..days month)) + {#February} (++ (..days month)) _ (..days month))) (def: .public year (List Month) - (list #January - #February - #March - #April - #May - #June - #July - #August - #September - #October - #November - #December)) + (list {#January} + {#February} + {#March} + {#April} + {#May} + {#June} + {#July} + {#August} + {#September} + {#October} + {#November} + {#December})) (exception: .public (not_a_month_of_the_year [value Text]) (exception.report @@ -210,33 +216,35 @@ (def: (encoded value) (case value (^template [<tag>] - [<tag> (template.text [<tag>])]) - ([#..January] - [#..February] - [#..March] - [#..April] - [#..May] - [#..June] - [#..July] - [#..August] - [#..September] - [#..October] - [#..November] - [#..December]))) + [{<tag>} + (text.replaced "#" "" (template.text [<tag>]))]) + ([..#January] + [..#February] + [..#March] + [..#April] + [..#May] + [..#June] + [..#July] + [..#August] + [..#September] + [..#October] + [..#November] + [..#December]))) (def: (decoded value) - (case value + (case (text#composite "#" value) (^template [<tag>] - [(^ (template.text [<tag>])) {#try.Success <tag>}]) - ([#..January] - [#..February] - [#..March] - [#..April] - [#..May] - [#..June] - [#..July] - [#..August] - [#..September] - [#..October] - [#..November] - [#..December]) + [(^ (template.text [<tag>])) + {try.#Success {<tag>}}]) + ([..#January] + [..#February] + [..#March] + [..#April] + [..#May] + [..#June] + [..#July] + [..#August] + [..#September] + [..#October] + [..#November] + [..#December]) _ (exception.except ..not_a_month_of_the_year [value])))) diff --git a/stdlib/source/library/lux/time/year.lux b/stdlib/source/library/lux/time/year.lux index cff485bde..adc9c8f92 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 a43b9a4d9..d583a072a 100644 --- a/stdlib/source/library/lux/tool/compiler/default/init.lux +++ b/stdlib/source/library/lux/tool/compiler/default/init.lux @@ -67,12 +67,12 @@ analysis_state [(analysisE.bundle eval host_analysis) (///analysis.state (///analysis.info ///version.version target))]] [extension.empty - [#///directive.analysis [#///directive.state analysis_state - #///directive.phase (analysisP.phase expander)] - #///directive.synthesis [#///directive.state synthesis_state - #///directive.phase synthesisP.phase] - #///directive.generation [#///directive.state generation_state - #///directive.phase generate]]])) + [///directive.#analysis [///directive.#state analysis_state + ///directive.#phase (analysisP.phase expander)] + ///directive.#synthesis [///directive.#state synthesis_state + ///directive.#phase synthesisP.phase] + ///directive.#generation [///directive.#state generation_state + ///directive.#phase generate]]])) (def: .public (with_default_directives expander host_analysis program anchorT,expressionT,directiveT extender) (All (_ anchor expression directive) @@ -94,21 +94,21 @@ (def: (reader current_module aliases [location offset source_code]) (-> Module Aliases Source (///analysis.Operation Reader)) (function (_ [bundle state]) - {#try.Success [[bundle state] + {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 - (with@ #.source source') - (with@ #.location location))] + {try.#Success [[bundle (|> compiler + (with@ .#source source') + (with@ .#location location))] [source' output]]})))) (type: (Operation a) @@ -125,13 +125,13 @@ (///directive.Operation anchor expression directive [Source (Payload directive)]))) (do ///phase.monad - [.let [module (value@ #///.module input)] + [.let [module (value@ ///.#module input)] _ (///directive.set_current_module module)] (///directive.lifted_analysis (do [! ///phase.monad] [_ (module.create hash module) _ (monad.each ! module.import dependencies) - .let [source (///analysis.source (value@ #///.module input) (value@ #///.code input))] + .let [source (///analysis.source (value@ ///.#module input) (value@ ///.#code input))] _ (///analysis.set_source_code source)] (in [source [///generation.empty_buffer artifact.empty]]))))) @@ -209,24 +209,24 @@ (..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)) (list& archive.runtime_module - (if (text\= prelude (value@ #///.module input)) + (if (text\= prelude (value@ ///.#module input)) (list) (list prelude)))) (def: module_aliases (-> .Module Aliases) - (|>> (value@ #.module_aliases) (dictionary.of_list text.hash))) + (|>> (value@ .#module_aliases) (dictionary.of_list text.hash))) (def: .public (compiler wrapper expander prelude write_directive) (All (_ anchor expression directive) @@ -235,41 +235,41 @@ (let [execute! (directiveP.phase wrapper expander)] (function (_ key parameters input) (let [dependencies (default_dependencies prelude input)] - [#///.dependencies dependencies - #///.process (function (_ state archive) + [///.#dependencies dependencies + ///.#process (function (_ state archive) (do [! try.monad] - [.let [hash (text\hash (value@ #///.code input))] + [.let [hash (text\hash (value@ ///.#code input))] [state [source buffer]] (<| (///phase.result' state) (..begin dependencies hash input)) - .let [module (value@ #///.module input)]] + .let [module (value@ ///.#module input)]] (loop [iteration (<| (///phase.result' state) (..iteration wrapper archive expander module source buffer ///syntax.no_aliases))] (do ! [[state ?source&requirements&temporary_payload] iteration] (case ?source&requirements&temporary_payload - #.None + {.#None} (do ! [[state [analysis_module [final_buffer final_registry]]] (///phase.result' state (..end module)) - .let [descriptor [#descriptor.hash hash - #descriptor.name module - #descriptor.file (value@ #///.file input) - #descriptor.references (set.of_list text.hash dependencies) - #descriptor.state #.Compiled - #descriptor.registry final_registry]]] + .let [descriptor [descriptor.#hash hash + descriptor.#name module + descriptor.#file (value@ ///.#file input) + descriptor.#references (set.of_list text.hash dependencies) + 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)]}])) - {#.Some [source requirements temporary_payload]} + {.#Some [source requirements temporary_payload]} (let [[temporary_buffer temporary_registry] temporary_payload] (in [state - {#.Left [#///.dependencies (|> requirements - (value@ #///directive.imports) + {.#Left [///.#dependencies (|> requirements + (value@ ///directive.#imports) (list\each product.left)) - #///.process (function (_ state archive) + ///.#process (function (_ state archive) (recur (<| (///phase.result' state) (do [! ///phase.monad] [analysis_module (<| (: (Operation .Module)) @@ -281,7 +281,7 @@ _ (///directive.lifted_generation (///generation.set_registry temporary_registry)) _ (|> requirements - (value@ #///directive.referrals) + (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))))))]}])) diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux index f884282eb..eda9c6147 100644 --- a/stdlib/source/library/lux/tool/compiler/default/platform.lux +++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux @@ -131,12 +131,12 @@ (def: (runtime_descriptor registry) (-> Registry Descriptor) - [#descriptor.hash 0 - #descriptor.name archive.runtime_module - #descriptor.file "" - #descriptor.references (set.empty text.hash) - #descriptor.state #.Compiled - #descriptor.registry registry]) + [descriptor.#hash 0 + descriptor.#name archive.runtime_module + descriptor.#file "" + descriptor.#references (set.empty text.hash) + descriptor.#state {.#Compiled} + descriptor.#registry registry]) (def: runtime_document (Document .Module) @@ -234,7 +234,7 @@ Import (List Context) (Async (Try [<State+> Archive ///phase.Wrapper])))) (do [! (try.with async.monad)] - [.let [state (//init.state (value@ #static.host static) + [.let [state (//init.state (value@ static.#host static) module expander host_analysis @@ -276,11 +276,11 @@ (def: (module_compilation_log module) (All (_ <type_vars>) (-> Module <State+> Text)) - (|>> (value@ [#extension.state - #///directive.generation - #///directive.state - #extension.state - #///generation.log]) + (|>> (value@ [extension.#state + ///directive.#generation + ///directive.#state + extension.#state + ///generation.#log]) (row\mix (function (_ right left) (format left ..compilation_log_separator right)) module))) @@ -288,11 +288,11 @@ (def: with_reset_log (All (_ <type_vars>) (-> <State+> <State+>)) - (with@ [#extension.state - #///directive.generation - #///directive.state - #extension.state - #///generation.log] + (with@ [extension.#state + ///directive.#generation + ///directive.#state + extension.#state + ///generation.#log] row.empty)) (def: empty @@ -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,30 +423,30 @@ [[_ dependence] (stm.update (..depend importer module) dependence)] (in dependence)))] (case (..verify_dependencies importer module dependence) - {#try.Failure error} - (in [(async.resolved {#try.Failure error}) - #.None]) + {try.#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]}) - #.None]) + (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]) + {.#None}]) - #.None + {.#None} (case (if (archive.reserved? archive module) (do try.monad [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]}])) - {#try.Failure error} - (in [(async\in {#try.Failure error}) - #.None]))))))))))) + {try.#Failure error} + (in [(async\in {try.#Failure error}) + {.#None}]))))))))))) _ (case signal - #.None + {.#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))))) @@ -500,14 +500,14 @@ .let [additions (|> modules (list\each product.left) (set.of_list text.hash))]] - (in (revised@ [#extension.state - #///directive.analysis - #///directive.state - #extension.state] + (in (revised@ [extension.#state + ///directive.#analysis + ///directive.#state + extension.#state] (function (_ analysis_state) (|> analysis_state (:as .Lux) - (revised@ #.modules (function (_ current) + (revised@ .#modules (function (_ current) (list\composite (list.only (|>> product.left (set.member? additions) not) @@ -544,14 +544,14 @@ importer import compilation_sources - (value@ #static.host_module_extension static) + (value@ static.#host_module_extension static) module)] (loop [[archive state] [archive state] compilation (base_compiler (:as ///.Input input)) all_dependencies (: (Set Module) (set.of_list text.hash (list)))] (do ! - [.let [new_dependencies (value@ #///.dependencies compilation) + [.let [new_dependencies (value@ ///.#dependencies compilation) continue! (:sharing [<type_vars>] <Platform> platform @@ -576,10 +576,10 @@ new_dependencies))] [archive state] (if (set.empty? duplicates) (case new_dependencies - #.End + {.#End} (in [archive state]) - {#.Item _} + {.#Item _} (do ! [archive,document+ (|> new_dependencies (list\each (import! module)) @@ -590,7 +590,7 @@ (in [archive (try.trusted (..updated_state archive state))]))) (async\in (exception.except ..cannot_import_twice [module duplicates])))] - (case ((value@ #///.process compilation) + (case ((value@ ///.#process compilation) ... TODO: The "///directive.set_current_module" below shouldn't be necessary. Remove it ASAP. ... TODO: The context shouldn't need to be re-set either. (|> (///directive.set_current_module 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)] + 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.lux b/stdlib/source/library/lux/tool/compiler/language/lux.lux index 251a543a3..39714d1c0 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux.lux @@ -86,10 +86,10 @@ ... #imports (<b>.list <b>.text) ... #module_state - (\ <>.monad in #.Cached)))) + (\ <>.monad in {.#Cached})))) (def: .public key (Key .Module) - (key.key [#signature.name (name_of ..compiler) - #signature.version /version.version] + (key.key [signature.#name (name_of ..compiler) + signature.#version /version.version] (module.empty 0))) 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 fb9566948..1fd1fe2b4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux @@ -37,7 +37,7 @@ (type: .public Primitive (.Variant - #Unit + {#Unit} {#Bit Bit} {#Nat Nat} {#Int Int} @@ -120,7 +120,7 @@ (def: (= reference sample) (case [reference sample] - [#Unit #Unit] + [{#Unit} {#Unit}] true (^template [<tag> <=>] @@ -213,7 +213,7 @@ [{#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]}] @@ -233,24 +233,24 @@ (template [<name> <tag>] [(template: .public (<name> content) - [(<tag> content)])] + [{<tag> content}])] - [control/case #..Case] + [control/case ..#Case] ) (template: .public (unit) - [{#..Primitive #..Unit}]) + [{..#Primitive {..#Unit}}]) (template [<name> <tag>] [(template: .public (<name> value) - [{#..Primitive {<tag> value}}])] - - [bit #..Bit] - [nat #..Nat] - [int #..Int] - [rev #..Rev] - [frac #..Frac] - [text #..Text] + [{..#Primitive {<tag> value}}])] + + [bit ..#Bit] + [nat ..#Nat] + [int ..#Int] + [rev ..#Rev] + [frac ..#Frac] + [text ..#Text] ) (type: .public (Abstraction c) @@ -265,11 +265,11 @@ (template: .public (no_op value) [(|> 1 - {#variable.Local} - {#reference.Variable} - {#..Reference} - {#..Function (list)} - {#..Apply value})]) + {variable.#Local} + {reference.#Variable} + {..#Reference} + {..#Function (list)} + {..#Apply value})]) (def: .public (apply [abstraction inputs]) (-> (Application Analysis) Analysis) @@ -284,19 +284,19 @@ inputs (list)] (case abstraction {#Apply input next} - (recur next {#.Item input inputs}) + (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)] @@ -304,48 +304,48 @@ (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} + [(.<| {..#Structure} {<tag>} content)])] - [variant #..Variant] - [tuple #..Tuple] + [variant ..#Variant] + [tuple ..#Tuple] ) (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] - [pattern/int #..Int] - [pattern/rev #..Rev] - [pattern/frac #..Frac] - [pattern/text #..Text] + [pattern/bit ..#Bit] + [pattern/nat ..#Nat] + [pattern/int ..#Int] + [pattern/rev ..#Rev] + [pattern/frac ..#Frac] + [pattern/text ..#Text] ) (template: .public (pattern/bind register) - [{#..Bind register}]) + [{..#Bind register}]) (def: .public (%analysis analysis) (Format Analysis) (case analysis {#Primitive primitive} (case primitive - #Unit + {#Unit} "[]" (^template [<tag> <format>] @@ -387,7 +387,7 @@ {#Apply _} (|> analysis ..application - {#.Item} + {.#Item} (list\each %analysis) (text.interposed " ") (text.enclosed ["(" ")"])) @@ -413,42 +413,42 @@ (def: .public (with_source_code source action) (All (_ a) (-> Source (Operation a) (Operation a))) (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')] + (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.Failure error} - {#try.Failure error})))) + {try.#Failure error} + {try.#Failure error})))) (def: fresh_bindings (All (_ k v) (Bindings k v)) - [#.counter 0 - #.mappings (list)]) + [.#counter 0 + .#mappings (list)]) (def: fresh_scope Scope - [#.name (list) - #.inner 0 - #.locals fresh_bindings - #.captured fresh_bindings]) + [.#name (list) + .#inner 0 + .#locals fresh_bindings + .#captured fresh_bindings]) (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 (value@ #.scopes state') - {#.Item head tail} - {#try.Success [[bundle' (with@ #.scopes tail state')] + (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]]} - #.End - {#try.Failure "Impossible error: Drained scopes!"}) + {.#End} + {try.#Failure "Impossible error: Drained scopes!"}) - {#try.Failure error} - {#try.Failure error}))) + {try.#Failure error} + {try.#Failure error}))) (def: scope_reset (List Scope) @@ -457,33 +457,33 @@ (def: .public (without_scopes action) (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')] + (case (action [bundle (with@ .#scopes ..scope_reset state)]) + {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}))) + (extension.localized (value@ .#current_module) + (with@ .#current_module) + (function.constant {.#Some name}))) (def: .public (with_location location action) (All (_ a) (-> Location (Operation a) (Operation a))) (if (text\= "" (product.left location)) action (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')] + (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.Failure error} - {#try.Failure error}))))) + {try.#Failure error} + {try.#Failure error}))))) (def: (locate_error location error) (-> Location Text Text) @@ -493,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)) @@ -508,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))) @@ -519,17 +519,17 @@ (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>] @@ -537,9 +537,9 @@ (-> <type> (Operation Any)) (extension.update (with@ <field> <value>)))] - [set_source_code Source #.source value] - [set_current_module Text #.current_module {#.Some value}] - [set_location Location #.location value] + [set_source_code Source .#source value] + [set_current_module Text .#current_module {.#Some value}] + [set_location Location .#location value] ) (def: .public (location file) @@ -556,28 +556,28 @@ (def: type_context Type_Context - [#.ex_counter 0 - #.var_counter 0 - #.var_bindings (list)]) + [.#ex_counter 0 + .#var_counter 0 + .#var_bindings (list)]) (def: .public (info version host) (-> Version Text Info) - [#.target host - #.version (%.nat version) - #.mode #.Build]) + [.#target host + .#version (%.nat version) + .#mode {.#Build}]) (def: .public (state info) (-> Info Lux) - [#.info info - #.source ..dummy_source - #.location location.dummy - #.current_module #.None - #.modules (list) - #.scopes (list) - #.type_context ..type_context - #.expected #.None - #.seed 0 - #.scope_type_vars (list) - #.extensions [] - #.eval (:as (-> Type Code (Meta Any)) []) - #.host []]) + [.#info info + .#source ..dummy_source + .#location location.dummy + .#current_module {.#None} + .#modules (list) + .#scopes (list) + .#type_context ..type_context + .#expected {.#None} + .#seed 0 + .#scope_type_vars (list) + .#extensions [] + .#eval (:as (-> Type Code (Meta Any)) []) + .#host []]) 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 ed5983d14..428e8011a 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 cd74d94f4..d11fa82cc 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux @@ -70,11 +70,11 @@ (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] - [generation #..generation (generation.Phase anchor expression directive)] + [analysis ..#analysis analysis.Phase] + [synthesis ..#synthesis synthesis.Phase] + [generation ..#generation (generation.Phase anchor expression directive)] ) (template [<name> <component> <operation>] @@ -82,13 +82,13 @@ (All (_ anchor expression directive output) (-> (<operation> output) (Operation anchor expression directive output))) - (|>> (phase.sub [(value@ [<component> #..state]) - (with@ [<component> #..state])]) + (|>> (phase.sub [(value@ [<component> ..#state]) + (with@ [<component> ..#state])]) extension.lifted))] - [lifted_analysis #..analysis analysis.Operation] - [lifted_synthesis #..synthesis synthesis.Operation] - [lifted_generation #..generation (generation.Operation anchor expression directive)] + [lifted_analysis ..#analysis analysis.Operation] + [lifted_synthesis ..#synthesis synthesis.Operation] + [lifted_generation ..#generation (generation.Operation anchor expression directive)] ) (def: .public (set_current_module module) 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 72a086650..ab139fc04 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux @@ -52,11 +52,11 @@ (type: .public (Host expression directive) (Interface (: (-> Context expression (Try Any)) - evaluate!) + evaluate) (: (-> directive (Try Any)) - execute!) + execute) (: (-> Context (Maybe Text) expression (Try [Text Any directive])) - define!) + define) (: (-> Context Binary directive) ingest) @@ -94,12 +94,12 @@ Module (..State anchor expression directive))) [#module module - #anchor #.None + #anchor {.#None} #host host - #buffer #.None + #buffer {.#None} #registry artifact.empty #counter 0 - #context #.None + #context {.#None} #log row.empty]) (def: .public empty_buffer @@ -115,30 +115,30 @@ (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')] + (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 + {.#None} (exception.except <exception> [])))) (def: .public (<set> value) (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 @@ -160,13 +160,13 @@ (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 @@ -196,33 +196,33 @@ (All (_ anchor expression directive) (-> 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]} + (case (\ (value@ #host state) evaluate label code) + {try.#Success output} + {try.#Success [state+ output]} - {#try.Failure error} - (exception.except ..cannot_interpret error)))) + {try.#Failure error} + (exception.except ..cannot_interpret [error])))) (def: .public (execute! code) (All (_ anchor expression directive) (-> directive (Operation anchor expression directive Any))) (function (_ (^@ state+ [bundle state])) - (case (\ (value@ #host state) execute! code) - {#try.Success output} - {#try.Success [state+ output]} + (case (\ (value@ #host state) execute code) + {try.#Success output} + {try.#Success [state+ output]} - {#try.Failure error} + {try.#Failure error} (exception.except ..cannot_interpret error)))) (def: .public (define! context custom code) (All (_ anchor expression directive) (-> 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]} + (case (\ (value@ #host state) define context custom code) + {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,13 +231,13 @@ (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 + {.#None} (phase.except ..no_buffer_for_saving_code [artifact_id])))) (template [<name> <artifact>] @@ -246,7 +246,7 @@ (-> 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)] + {try.#Success [[bundle (with@ #registry registry' state)] id]})))] [learn artifact.definition] @@ -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 + {.#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) @@ -298,10 +298,10 @@ (-> Archive (Operation anchor expression directive Context))) (function (_ (^@ stateE [bundle state])) (case (value@ #context state) - #.None + {.#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 5bebbcde9..c3b6434d2 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 @@ -49,35 +49,32 @@ (^template [<tag> <analyser>] [{<tag> value} (<analyser> value)]) - ([#.Bit /primitive.bit] - [#.Nat /primitive.nat] - [#.Int /primitive.int] - [#.Rev /primitive.rev] - [#.Frac /primitive.frac] - [#.Text /primitive.text]) - - (^ {#.Variant (list& [_ {#.Tag tag}] + ([.#Bit /primitive.bit] + [.#Nat /primitive.nat] + [.#Int /primitive.int] + [.#Rev /primitive.rev] + [.#Frac /primitive.frac] + [.#Text /primitive.text]) + + (^ {.#Variant (list& [_ {.#Identifier tag}] values)}) (case values - {#.Item value #.End} + {.#Item value {.#End}} (/structure.tagged_sum compile tag archive value) _ (/structure.tagged_sum compile tag archive (` [(~+ values)]))) - (^ {#.Variant (list& [_ {#.Nat lefts}] [_ {#.Bit right?}] + (^ {.#Variant (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} - (/structure.tagged_sum compile tag archive (' [])) - - (^ {#.Tuple elems}) + (^ {.#Tuple elems}) (/structure.record archive compile elems) _ @@ -86,32 +83,32 @@ (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 [_ {#.Variant branches}] input)}) + (^ {.#Form (list [_ {.#Variant branches}] input)}) (if (n.even? (list.size branches)) (/case.case compile (list.pairs branches) archive input) (//.except ..unrecognized_syntax [location.dummy code'])) - (^ {#.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]}])}] + (^ {.#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 69307c2ac..5d6489898 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,11 +69,11 @@ (def: (re_quantify envs baseT) (-> (List (List Type)) Type Type) (.case envs - #.End + {.#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 @@ -88,53 +88,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 + {.#None} (/.except ..cannot_simplify_for_pattern_matching caseT))) - {#.Product _} + {.#Product _} (|> caseT type.flat_tuple (list\each (re_quantify envs)) @@ -172,75 +172,75 @@ (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)}]) - (analyse_pattern #.None inputT singleton next) + (^ [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)))] + {.#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 + {.#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]) - #.End)] + {.#End})] (.case [types patterns] - [#.End #.End] + [{.#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)))] @@ -252,7 +252,7 @@ (do ! [[memberP [memberP+ thenA]] ((:as (All (_ a) (-> (Maybe Nat) Type Code (Operation a) (Operation [Pattern a]))) analyse_pattern) - #.None memberT memberC then)] + {.#None} memberT memberC then)] (in [(list& memberP memberP+) thenA])))) (do ! [nextA next] @@ -264,38 +264,38 @@ _ (/.except ..cannot_match_with_pattern [inputT' pattern])))))) - [location {#.Tag tag}] + [location {.#Tag tag}] (/.with_location location - (analyse_pattern #.None inputT (` {(~ pattern)}) next)) + (analyse_pattern {.#None} inputT (` {(~ pattern)}) next)) - (^ [location {#.Variant (list& [_ {#.Nat lefts}] [_ {#.Bit right?}] values)}]) + (^ [location {.#Variant (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) (n.= (-- num_cases) idx)) - (analyse_pattern #.None + (analyse_pattern {.#None} (type.variant (list.after (-- num_cases) flat_sum)) (` [(~+ values)]) next) - (analyse_pattern #.None caseT (` [(~+ values)]) next))] + (analyse_pattern {.#None} caseT (` [(~+ values)]) next))] (in [(/.pattern/variant [lefts right? testP]) nextA])) _ (/.except ..sum_has_no_case [idx inputT]))) - {#.UnivQ _} + {.#UnivQ _} (do ///.monad [[ex_id exT] (//type.with_env check.existential)] @@ -307,7 +307,7 @@ _ (/.except ..cannot_match_with_pattern [inputT' pattern])))) - (^ [location {#.Variant (list& [_ {#.Tag tag}] values)}]) + (^ [location {.#Variant (list& [_ {.#Tag tag}] values)}]) (/.with_location location (do ///.monad [tag (///extension.lifted (meta.normal tag)) @@ -315,7 +315,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) @@ -324,25 +324,25 @@ (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)) - outputH (analyse_pattern #.None inputT patternH (analyse archive bodyH)) + outputH (analyse_pattern {.#None} inputT patternH (analyse archive bodyH)) outputT (monad.each ! (function (_ [patternT bodyT]) - (analyse_pattern #.None inputT patternT (analyse archive bodyT))) + (analyse_pattern {.#None} inputT patternT (analyse archive bodyT))) branchesT) 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 + {.#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 59ecb1717..813324061 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 @@ -50,12 +50,12 @@ (type: .public Coverage (Rec Coverage (.Variant - #Partial + {#Partial} {#Bit Bit} {#Variant (Maybe Nat) (Dictionary Nat Coverage)} {#Seq Coverage Coverage} {#Alt Coverage Coverage} - #Exhaustive))) + {#Exhaustive}))) (def: .public (exhaustive? coverage) (-> Coverage Bit) @@ -69,7 +69,7 @@ (def: .public (%coverage value) (Format Coverage) (case value - #Partial + {#Partial} "#Partial" {#Bit value'} @@ -93,41 +93,41 @@ {#Alt left right} (format "{#Alt " (%coverage left) " " (%coverage right) "}") - #Exhaustive + {#Exhaustive} "#Exhaustive")) (def: .public (determine pattern) (-> Pattern (Operation Coverage)) (case pattern - (^or {#/.Simple #/.Unit} - {#/.Bind _}) - (////\in #Exhaustive) + (^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> _}} - (////\in #Partial)]) - ([#/.Nat] - [#/.Int] - [#/.Rev] - [#/.Frac] - [#/.Text]) + [{/.#Simple {<tag> _}} + (////\in {#Partial})]) + ([/.#Nat] + [/.#Int] + [/.#Rev] + [/.#Frac] + [/.#Text]) ... 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}} + {/.#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 @@ -135,7 +135,7 @@ (do ////.monad [leftC (determine leftP)] (case rightC - #Exhaustive + {#Exhaustive} (in leftC) _ @@ -144,15 +144,15 @@ ... 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} - #.None) + {.#Some idx} + {.#None}) (|> (dictionary.empty n.hash) (dictionary.has idx value_coverage))})))) @@ -185,7 +185,7 @@ (implementation: equivalence (Equivalence Coverage) (def: (= reference sample) (case [reference sample] - [#Exhaustive #Exhaustive] + [{#Exhaustive} {#Exhaustive}] #1 [{#Bit sideR} {#Bit sideS}] @@ -226,13 +226,13 @@ (def: .public (merged addition so_far) (-> Coverage Coverage (Try Coverage)) (case [addition so_far] - [#Partial #Partial] - (try\in #Partial) + [{#Partial} {#Partial}] + (try\in {#Partial}) ... 2 bit coverages are exhaustive if they complement one another. (^multi [{#Bit sideA} {#Bit sideSF}] (xor sideA sideSF)) - (try\in #Exhaustive) + (try\in {#Exhaustive}) [{#Variant allA casesA} {#Variant allSF casesSF}] (let [addition_cases (cases allSF) @@ -250,12 +250,12 @@ [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'))) - #.None + {.#None} (in (dictionary.has tagA coverageA casesSF')))) casesSF (dictionary.entries casesA))] (in (if (and (or (known_cases? addition_cases) @@ -263,9 +263,9 @@ (n.= (++ (n.max addition_cases so_far_cases)) (dictionary.size casesM)) (list.every? exhaustive? (dictionary.values casesM))) - #Exhaustive + {#Exhaustive} {#Variant (case allSF - {#.Some _} + {.#Some _} allSF _ @@ -300,12 +300,12 @@ (exception.except ..redundant_pattern [so_far addition])) ... The addition cannot possibly improve the coverage. - [_ #Exhaustive] + [_ {#Exhaustive}] (exception.except ..redundant_pattern [so_far addition]) ... The addition completes the coverage. - [#Exhaustive _] - (try\in #Exhaustive) + [{#Exhaustive} _] + (try\in {#Exhaustive}) ... The left part will always match, so the addition is redundant. (^multi [{#Seq left right} single] @@ -334,41 +334,41 @@ (function (_ coverageA possibilitiesSF) (loop [altsSF possibilitiesSF] (case altsSF - #.End - (in [#.None (list coverageA)]) + {.#End} + (in [{.#None} (list coverageA)]) - {#.Item altSF altsSF'} + {.#Item altSF altsSF'} (case (merged coverageA altSF) - {#try.Success altMSF} + {try.#Success altMSF} (case altMSF {#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 + {.#None} (case (list.reversed possibilitiesSF) - {#.Item last prevs} + {.#Item last prevs} (in (list\mix (function (_ left right) {#Alt left right}) last prevs)) - #.End + {.#End} (undefined))))) _ 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 5b1ba0a7b..ab080a2b8 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,15 +54,15 @@ (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 + {.#None} (/.failure (ex.error cannot_analyse [expectedT function_name arg_name body]))) (^template [<tag> <instancer>] @@ -70,15 +70,15 @@ (do ! [[_ instanceT] (//type.with_env <instancer>)] (recur (maybe.trusted (type.applied (list instanceT) expectedT))))]) - ([#.UnivQ check.existential] - [#.ExQ check.var]) + ([.#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,15 +86,15 @@ (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})) /.with_scope 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 68fafe17f..e377fedb0 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,20 +66,20 @@ (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)}]) - ([#.Sum] - [#.Product] - [#.Function] - [#.Apply]) + ([.#Sum] + [.#Product] + [.#Function] + [.#Apply]) - {#.Parameter idx} + {.#Parameter idx} (if (n.= parameter_idx idx) replacement type) @@ -88,8 +88,8 @@ [{<tag> env quantified} {<tag> (list\each (replace parameter_idx replacement) env) (replace (n.+ 2 parameter_idx) replacement quantified)}]) - ([#.UnivQ] - [#.ExQ]) + ([.#UnivQ] + [.#ExQ]) _ type)) @@ -97,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) @@ -116,22 +116,22 @@ (def: .public (general archive analyse inferT args) (-> Archive Phase Type (List Code) (Operation [Type (List Analysis)])) (case args - #.End + {.#End} (do ///.monad [_ (//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 @@ -147,12 +147,12 @@ (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 + {.#None} (/.except ..invalid_type_application inferT)) ... Arguments are inferred back-to-front because, by convention, @@ -162,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]) @@ -170,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) _ @@ -189,15 +189,15 @@ (-> 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)}]) - ([#.Sum] [#.Product] [#.Function] [#.Apply]) + ([.#Sum] [.#Product] [.#Function] [.#Apply]) - {#.Parameter index} + {.#Parameter index} (if (n.= target index) sub base) @@ -205,7 +205,7 @@ (^template [<tag>] [{<tag> environment quantified} {<tag> (list\each recur environment) quantified}]) - ([#.UnivQ] [#.ExQ]) + ([.#UnivQ] [.#ExQ]) _ base))) @@ -214,7 +214,7 @@ (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>] @@ -222,18 +222,18 @@ (do ///.monad [bodyT+ (record' record_size (n.+ 2 target) originalT bodyT)] (in {<tag> env bodyT+}))]) - ([#.UnivQ] - [#.ExQ]) + ([.#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 + {.#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)))) @@ -252,7 +252,7 @@ (loop [depth 0 currentT inferT] (case currentT - {#.Named name unnamedT} + {.#Named name unnamedT} (do ///.monad [unnamedT+ (recur depth unnamedT)] (in unnamedT+)) @@ -262,10 +262,10 @@ (do ///.monad [bodyT+ (recur (++ depth) bodyT)] (in {<tag> env bodyT+}))]) - ([#.UnivQ] - [#.ExQ]) + ([.#UnivQ] + [.#ExQ]) - {#.Sum _} + {.#Sum _} (let [cases (type.flat_variant currentT) actual_size (list.size cases) boundary (-- expected_size)] @@ -273,14 +273,14 @@ (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)] (type.function (list (replace' caseT)) (replace' currentT))))) - #.None + {.#None} (/.except ..variant_tag_out_of_bounds [expected_size tag inferT])) (n.< expected_size actual_size) @@ -297,12 +297,12 @@ ... 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 + {.#None} (/.except ..invalid_type_application inferT)) _ 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 84124d32f..dde8eb173 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 @@ -64,17 +64,17 @@ (exception.report ["Module" module] ["Desired state" (case state - #.Active "Active" - #.Compiled "Compiled" - #.Cached "Cached")])) + {.#Active} "Active" + {.#Compiled} "Compiled" + {.#Cached} "Cached")])) (def: .public (empty hash) (-> Nat Module) - [#.module_hash hash - #.module_aliases (list) - #.definitions (list) - #.imports (list) - #.module_state #.Active]) + [.#module_hash hash + .#module_aliases (list) + .#definitions (list) + .#imports (list) + .#module_state {.#Active}]) (def: .public (import module) (-> Text (Operation Any)) @@ -82,12 +82,12 @@ (do ///.monad [self_name meta.current_module_name] (function (_ state) - {#try.Success [(revised@ #.modules - (plist.revised self_name (revised@ #.imports (function (_ current) + {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) []]})))) @@ -97,9 +97,9 @@ (do ///.monad [self_name meta.current_module_name] (function (_ state) - {#try.Success [(revised@ #.modules - (plist.revised self_name (revised@ #.module_aliases (: (-> (List [Text Text]) (List [Text Text])) - (|>> {#.Item [alias module]})))) + {try.#Success [(revised@ .#modules + (plist.revised self_name (revised@ .#module_aliases (: (-> (List [Text Text]) (List [Text Text])) + (|>> {.#Item [alias module]})))) state) []]})))) @@ -108,10 +108,10 @@ (///extension.lifted (function (_ state) (|> state - (value@ #.modules) + (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)) @@ -120,25 +120,25 @@ [self_name meta.current_module_name self meta.current_module] (function (_ state) - (case (plist.value name (value@ #.definitions self)) - #.None - {#try.Success [(revised@ #.modules + (case (plist.value name (value@ .#definitions self)) + {.#None} + {try.#Success [(revised@ .#modules (plist.has self_name - (revised@ #.definitions + (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) []]}))) @@ -157,50 +157,50 @@ (-> Text (Operation Any)) (///extension.lifted (function (_ state) - (case (|> state (value@ #.modules) (plist.value module_name)) - {#.Some module} - (let [active? (case (value@ #.module_state module) - #.Active #1 - _ #0)] + (case (|> state (value@ .#modules) (plist.value module_name)) + {.#Some module} + (let [active? (case (value@ .#module_state module) + {.#Active} #1 + _ #0)] (if active? - {#try.Success [(revised@ #.modules - (plist.has module_name (with@ #.module_state <tag> module)) + {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>]) + ((/.except' can_only_change_state_of_active_module [module_name {<tag>}]) state))) - #.None + {.#None} ((/.except' unknown_module module_name) state))))) (def: .public (<asker> module_name) (-> Text (Operation Bit)) (///extension.lifted (function (_ state) - (case (|> state (value@ #.modules) (plist.value module_name)) - {#.Some module} - {#try.Success [state - (case (value@ #.module_state module) + (case (|> state (value@ .#modules) (plist.value module_name)) + {.#Some module} + {try.#Success [state + (case (value@ .#module_state module) <tag> #1 _ #0)]} - #.None + {.#None} ((/.except' unknown_module module_name) state)))))] - [set_active active? #.Active] - [set_compiled compiled? #.Compiled] - [set_cached cached? #.Cached] + [set_active active? .#Active] + [set_compiled compiled? .#Compiled] + [set_cached cached? .#Cached] ) (def: (hash module_name) (-> Text (Operation Nat)) (///extension.lifted (function (_ state) - (case (|> state (value@ #.modules) (plist.value module_name)) - {#.Some module} - {#try.Success [state (value@ #.module_hash module)]} + (case (|> state (value@ .#modules) (plist.value module_name)) + {.#Some module} + {try.#Success [state (value@ .#module_hash module)]} - #.None + {.#None} ((/.except' unknown_module module_name) state))))) (def: .public (declare_tags record? tags exported? type) @@ -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) _ @@ -216,8 +216,8 @@ _ (///.assertion cannot_declare_tags_for_foreign_type [tags type] (text\= self_name type_module))] (monad.each ! (function (_ [index short]) - (..define (format "#" short) + (..define 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 ad481b931..fe8c61096 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,18 +16,18 @@ (-> <type> (Operation Analysis)) (do ///.monad [_ (//type.infer <type>)] - (in {#/.Primitive {<tag> value}})))] + (in {/.#Primitive {<tag> value}})))] - [bit .Bit #/.Bit] - [nat .Nat #/.Nat] - [int .Int #/.Int] - [rev .Rev #/.Rev] - [frac .Frac #/.Frac] - [text .Text #/.Text] + [bit .Bit /.#Bit] + [nat .Nat /.#Nat] + [int .Int /.#Int] + [rev .Rev /.#Rev] + [frac .Frac /.#Frac] + [text .Text /.#Text] ) (def: .public unit (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 26946da08..05495f98d 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 @@ -36,14 +36,14 @@ (def: (definition def_name) (-> Name (Operation Analysis)) - (with_expansions [<return> (in (|> def_name ///reference.constant #/.Reference))] + (with_expansions [<return> (in (|> def_name ///reference.constant {/.#Reference}))] (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,13 +84,13 @@ (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)))) + {.#None} + (in {.#None})))) (def: .public (reference reference) (-> Name (Operation Analysis)) @@ -99,10 +99,10 @@ (do [! ///.monad] [?var (variable simple_name)] (case ?var - {#.Some varA} + {.#Some varA} (in varA) - #.None + {.#None} (do ! [this_module (///extension.lifted meta.current_module_name)] (definition [this_module simple_name])))) 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 cb737d36d..d14adf09f 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 @@ -32,35 +32,35 @@ (def: (local? name scope) (-> Text Scope Bit) (|> scope - (value@ [#.locals #.mappings]) + (value@ [.#locals .#mappings]) (plist.contains? name))) (def: (local name scope) (-> Text Scope (Maybe [Type Variable])) (|> scope - (value@ [#.locals #.mappings]) + (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) (|> scope - (value@ [#.captured #.mappings]) + (value@ [.#captured .#mappings]) (plist.contains? name))) (def: (captured name scope) (-> Text Scope (Maybe [Type Variable])) (loop [idx 0 - mappings (value@ [#.captured #.mappings] scope)] + 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 - #.None))) + {.#End} + {.#None}))) (def: (reference? name scope) (-> Text Scope Bit) @@ -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))) @@ -81,29 +81,29 @@ (///extension.lifted (function (_ state) (let [[inner outer] (|> state - (value@ #.scopes) + (value@ .#scopes) (list.split_when (|>> (reference? name))))] (case outer - #.End - {#.Right [state #.None]} + {.#End} + {.#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)])))) + (|>> (revised@ .#counter ++) + (revised@ .#mappings (plist.has name [ref_type (product.left ref+inner)])))) scope) (product.right ref+inner)}])) - [init_ref #.End] + [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) @@ -112,30 +112,30 @@ (def: .public (with_local [name type] action) (All (_ a) (-> [Text Type] (Operation a) (Operation a))) (function (_ [bundle state]) - (case (value@ #.scopes state) - {#.Item head tail} - (let [old_mappings (value@ [#.locals #.mappings] head) - new_var_id (value@ [#.locals #.counter] head) - new_head (revised@ #.locals + (case (value@ .#scopes state) + {.#Item head tail} + (let [old_mappings (value@ [.#locals .#mappings] head) + new_var_id (value@ [.#locals .#counter] head) + new_head (revised@ .#locals (: (-> Local Local) - (|>> (revised@ #.counter ++) - (revised@ #.mappings (plist.has name [type new_var_id])))) + (|>> (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]} - (case (value@ #.scopes state') - {#.Item head' tail'} - (let [scopes' {#.Item (with@ #.locals (value@ #.locals head) head') + {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')] + {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 [])) @@ -144,8 +144,8 @@ (template [<name> <val_type>] [(def: <name> (Bindings Text [Type <val_type>]) - [#.counter 0 - #.mappings (list)])] + [.#counter 0 + .#mappings (list)])] [init_locals Nat] [init_captured Variable] @@ -153,31 +153,31 @@ (def: (scope parent_name child_name) (-> (List Text) Text Scope) - [#.name (list& child_name parent_name) - #.inner 0 - #.locals init_locals - #.captured init_captured]) + [.#name (list& child_name parent_name) + .#inner 0 + .#locals init_locals + .#captured init_captured]) (def: .public (with_scope name action) (All (_ a) (-> Text (Operation a) (Operation a))) (function (_ [bundle state]) - (let [parent_name (case (value@ #.scopes state) - #.End + (let [parent_name (case (value@ .#scopes state) + {.#End} (list) - {#.Item top _} - (value@ #.name top))] - (case (action [bundle (revised@ #.scopes - (|>> {#.Item (scope parent_name name)}) + {.#Item top _} + (value@ .#name top))] + (case (action [bundle (revised@ .#scopes + (|>> {.#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]} - {#try.Failure error} - {#try.Failure error})))) + {try.#Failure error} + {try.#Failure error})))) (exception: .public cannot_get_next_reference_when_there_is_no_scope) @@ -185,24 +185,24 @@ (Operation Register) (///extension.lifted (function (_ state) - (case (value@ #.scopes state) - {#.Item top _} - {#try.Success [state (value@ [#.locals #.counter] top)]} + (case (value@ .#scopes state) + {.#Item top _} + {try.#Success [state (value@ [.#locals .#counter] top)]} - #.End + {.#End} (exception.except ..cannot_get_next_reference_when_there_is_no_scope []))))) (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)) (|> scope - (value@ [#.captured #.mappings]) + (value@ [.#captured .#mappings]) (list\each (function (_ [_ [_ ref]]) (ref_variable ref))))) 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 0ccb8f1e0..188d8f7b8 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 @@ -115,28 +115,28 @@ (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))] (in (/.variant [lefts right? valueA]))) - #.None + {.#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)) @@ -152,18 +152,18 @@ [[instance_id instanceT] (//type.with_env <instancer>)] (//type.with_type (maybe.trusted (type.applied (list instanceT) expectedT)) (recur valueC)))]) - ([#.UnivQ check.existential] - [#.ExQ check.var]) + ([.#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)) _ @@ -171,11 +171,11 @@ _ (case (type.applied (list inputT) funT) - {#.Some outputT} + {.#Some outputT} (//type.with_type outputT (recur valueC)) - #.None + {.#None} (/.except ..not_a_quantified_type funT))) _ @@ -189,26 +189,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]))))] @@ -220,19 +220,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)) @@ -252,18 +252,18 @@ [[instance_id instanceT] (//type.with_env <instancer>)] (//type.with_type (maybe.trusted (type.applied (list instanceT) expectedT)) (product archive analyse membersC)))]) - ([#.UnivQ check.existential] - [#.ExQ check.var]) + ([.#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)) _ @@ -271,11 +271,11 @@ _ (case (type.applied (list inputT) funT) - {#.Some outputT} + {.#Some outputT} (//type.with_type outputT (product archive analyse membersC)) - #.None + {.#None} (/.except ..not_a_quantified_type funT))) _ @@ -291,7 +291,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,18 +308,18 @@ (-> (List Code) (Operation (Maybe (List [Name Code])))) (loop [input record output (: (List [Name Code]) - #.End)] + {.#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}) + {.#End} + (\ ///.monad in {.#Some output}) _ - (\ ///.monad in #.None)))) + (\ ///.monad in {.#None})))) ... Lux already possesses the means to analyse tuples, so ... re-implementing the same functionality for records makes no sense. @@ -328,17 +328,17 @@ (-> (List [Name Code]) (Operation (Maybe [Nat (List Code) Type]))) (case record ... empty_record = empty_tuple = unit/any = [] - #.End - (\ ///.monad in {#.Some [0 (list) Any]}) + {.#End} + (\ ///.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)] @@ -352,12 +352,12 @@ (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))) - #.None + {.#None} (/.except ..slot_does_not_belong_to_record [key recordT])))) (: (Dictionary Nat Code) (dictionary.empty n.hash)) @@ -365,10 +365,10 @@ .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} - (in #.None))) + {try.#Failure error} + (in {.#None}))) )) (def: .public (record archive analyse members) @@ -380,12 +380,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)) @@ -397,21 +397,21 @@ (do [! ///.monad] [?members (normal members)] (case ?members - #.None + {.#None} (..product archive analyse members) - {#.Some slots} + {.#Some slots} (do ! [record_size,membersC,recordT (..order slots)] (case record_size,membersC,recordT - #.None + {.#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 33a8715d5..1f53c1154 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 @@ -18,23 +18,23 @@ (def: .public (with_type expected) (All (_ a) (-> Type (Operation a) (Operation a))) - (///extension.localized (value@ #.expected) (with@ #.expected) - (function.constant {#.Some expected}))) + (///extension.localized (value@ .#expected) (with@ .#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)] + (case (action (value@ .#type_context state)) + {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 (All (_ a) (-> (Operation a) (Operation a))) - (///extension.localized (value@ #.type_context) (with@ #.type_context) + (///extension.localized (value@ .#type_context) (with@ .#type_context) (function.constant check.fresh_context))) (def: .public (infer actualT) 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 dc47f7039..0d95f2262 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)] @@ -62,18 +62,18 @@ (do [! //.monad] [state //.get_state .let [compiler_eval (meta_eval archive - (value@ [#//extension.state #/.analysis #/.state #//extension.bundle] state) + (value@ [//extension.#state /.#analysis /.#state //extension.#bundle] state) (evaluation.evaluator expander - (value@ [#//extension.state #/.synthesis #/.state] state) - (value@ [#//extension.state #/.generation #/.state] state) - (value@ [#//extension.state #/.generation #/.phase] state))) + (value@ [//extension.#state /.#synthesis /.#state] state) + (value@ [//extension.#state /.#generation /.#state] state) + (value@ [//extension.#state /.#generation /.#phase] state))) extension_eval (:as Eval (wrapper (:expected compiler_eval)))] - _ (//.set_state (with@ [#//extension.state #/.analysis #/.state #//extension.state #.eval] extension_eval state))] + _ (//.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,10 +84,10 @@ (do ! [?macro (//extension.lifted (meta.macro macro_name)) macro (case ?macro - {#.Some macro} + {.#Some macro} (in macro) - #.None + {.#None} (//.except ..macro_was_not_found macro_name))] (//extension.lifted (///analysis/macro.expand expander macro_name macro inputs))) @@ -96,7 +96,7 @@ (case expansion (^ (list& <lux_def_module> referrals)) (|> (recur archive <lux_def_module>) - (\ ! each (revised@ #/.referrals (list\composite referrals)))) + (\ ! each (revised@ /.#referrals (list\composite referrals)))) _ (|> expansion 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 2fd695eef..7f3481817 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 @@ -97,8 +97,8 @@ (-> (Extender s i o) Text (Handler s i o) (Operation s i o Any))) (function (_ [bundle state]) (case (dictionary.value name bundle) - #.None - {#try.Success [[(dictionary.has name (extender handler) bundle) state] + {.#None} + {try.#Success [[(dictionary.has name (extender handler) bundle) state] []]} _ @@ -119,11 +119,11 @@ (-> 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) - #.None + {.#None} (exception.except ..unknown [name bundle])))) (def: .public (localized get set transform) @@ -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 36578eb15..6de21c89b 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,7 +128,7 @@ [objectA (analysis/type.with_type Any (phase archive objectC)) _ (analysis/type.infer .Any)] - (in {#analysis.Extension extension (list (analysis.text fieldC) + (in {analysis.#Extension extension (list (analysis.text fieldC) objectA)})))])) (def: object::do @@ -141,7 +141,7 @@ (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)})))])) @@ -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,7 +201,7 @@ (phase archive abstractionC)) _ (analysis/type.infer (for [@.js ffi.Function] Any))] - (in {#analysis.Extension extension (list (analysis.nat arity) + (in {analysis.#Extension extension (list (analysis.nat arity) abstractionA)})))])) (def: .public 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 f9cf0b336..88b935e35 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 + {.#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,31 +355,31 @@ (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 + {.#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 + {.#End} (phase\in primitive_type) _ (/////analysis.except ..primitives_cannot_have_type_parameters class)) - #.None + {.#None} (do [! phase.monad] [parametersJT (: (Operation (List (Type Parameter))) (monad.each ! @@ -387,15 +387,15 @@ (do phase.monad [parameterJT (jvm_type parameterT)] (case (jvm_parser.parameter? parameterJT) - {#.Some parameterJT} + {.#Some parameterJT} (in parameterJT) - #.None + {.#None} (/////analysis.except ..non_parameter parameterT)))) 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)} (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,7 +438,7 @@ (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)) + (in {/////analysis.#Extension extension_name (list (/////analysis.text (..signature arrayJT)) arrayA)})) _ @@ -452,9 +452,9 @@ (do phase.monad [lengthA (typeA.with_type ..int (analyse archive lengthC)) - _ (typeA.infer {#.Primitive (|> (jvm.array primitive_type) ..reflection) + _ (typeA.infer {.#Primitive (|> (jvm.array primitive_type) ..reflection) (list)})] - (in {#/////analysis.Extension extension_name (list lengthA)})) + (in {/////analysis.#Extension extension_name (list lengthA)})) _ (/////analysis.except ///.incorrect_arity [extension_name 1 (list.size args)])))) @@ -470,12 +470,12 @@ expectedT (///.lifted meta.expected_type) expectedJT (jvm_array_type expectedT) elementJT (case (jvm_parser.array? expectedJT) - {#.Some elementJT} + {.#Some elementJT} (in elementJT) - #.None + {.#None} (/////analysis.except ..non_array expectedT))] - (in {#/////analysis.Extension extension_name (list (/////analysis.text (..signature elementJT)) + (in {/////analysis.#Extension extension_name (list (/////analysis.text (..signature elementJT)) lengthA)})) _ @@ -484,11 +484,11 @@ (def: (check_parameter objectT) (-> .Type (Operation (Type Parameter))) (case objectT - (^ {#.Primitive (static array.type_name) + (^ {.#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,27 +506,27 @@ ... else (phase\in (jvm.class name (list))))) - {#.Named name anonymous} + {.#Named name anonymous} (check_parameter anonymous) (^template [<tag>] [{<tag> id} (phase\in (jvm.class ..object_class (list)))]) - ([#.Var] - [#.Ex]) + ([.#Var] + [.#Ex]) (^template [<tag>] [{<tag> env unquantified} (check_parameter unquantified)]) - ([#.UnivQ] - [#.ExQ]) + ([.#UnivQ] + [.#ExQ]) - {#.Apply inputT abstractionT} + {.#Apply inputT abstractionT} (case (type.applied (list inputT) abstractionT) - {#.Some outputT} + {.#Some outputT} (check_parameter outputT) - #.None + {.#None} (/////analysis.except ..non_parameter objectT)) _ @@ -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,37 +565,37 @@ (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) + (^ {.#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} (check_jvm unquantified)]) - ([#.UnivQ] - [#.ExQ]) + ([.#UnivQ] + [.#ExQ]) - {#.Apply inputT abstractionT} + {.#Apply inputT abstractionT} (case (type.applied (list inputT) abstractionT) - {#.Some outputT} + {.#Some outputT} (check_jvm outputT) - #.None + {.#None} (/////analysis.except ..non_object objectT)) _ @@ -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) + 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,7 +647,7 @@ 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)})) @@ -656,7 +656,7 @@ (def: (write_primitive_array_handler lux_type jvm_type) (-> .Type (Type Primitive) Handler) - (let [array_type {#.Primitive (|> (jvm.array jvm_type) ..reflection) + (let [array_type {.#Primitive (|> (jvm.array jvm_type) ..reflection) (list)}] (function (_ extension_name analyse archive args) (case args @@ -669,7 +669,7 @@ (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)})) @@ -693,7 +693,7 @@ (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)})) @@ -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} - (list& super (array.list #.None (java/lang/Class::getGenericInterfaces source_class))) + {.#Some super} + (list& super (array.list {.#None} (java/lang/Class::getGenericInterfaces source_class))) - #.None + {.#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))} - (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,13 +959,13 @@ (case (|> candidate_parents (list.only product.right) (list\each product.left)) - {#.Item [next_name nextT] _} + {.#Item [next_name nextT] _} (recur [next_name nextT]) - #.End + {.#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)}) (/////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)) @@ -1087,30 +1087,30 @@ (type: Method_Style (Variant - #Static - #Abstract - #Virtual - #Special - #Interface)) + {#Static} + {#Abstract} + {#Virtual} + {#Special} + {#Interface})) (def: (check_method aliasing class method_name method_style inputsJT method) (-> Aliasing (java/lang/Class java/lang/Object) Text Method_Style (List (Type Value)) java/lang/reflect/Method (Operation Bit)) (do phase.monad [parameters (|> (java/lang/reflect/Method::getGenericParameterTypes method) - (array.list #.None) + (array.list {.#None}) (monad.each try.monad reflection!.type) phase.lifted) .let [modifiers (java/lang/reflect/Method::getModifiers method) correct_class? (java/lang/Object::equals class (java/lang/reflect/Method::getDeclaringClass method)) correct_method? (text\= method_name (java/lang/reflect/Method::getName method)) static_matches? (case method_style - #Static + {#Static} (java/lang/reflect/Modifier::isStatic modifiers) _ true) special_matches? (case method_style - #Special + {#Special} (not (or (java/lang/reflect/Modifier::isInterface (java/lang/Class::getModifiers class)) (java/lang/reflect/Modifier::isAbstract modifiers))) @@ -1122,13 +1122,13 @@ (and prev (jvm\= expectedJC (: (Type Value) (case (jvm_parser.var? actualJC) - {#.Some name} + {.#Some name} (|> aliasing (dictionary.value name) (maybe.else name) jvm.var) - #.None + {.#None} actualJC))))) true (list.zipped/2 parameters inputsJT)))]] @@ -1143,7 +1143,7 @@ (-> Aliasing (java/lang/Class java/lang/Object) (List (Type Value)) (java/lang/reflect/Constructor java/lang/Object) (Operation Bit)) (do phase.monad [parameters (|> (java/lang/reflect/Constructor::getGenericParameterTypes constructor) - (array.list #.None) + (array.list {.#None}) (monad.each try.monad reflection!.type) phase.lifted)] (in (and (java/lang/Object::equals class (java/lang/reflect/Constructor::getDeclaringClass constructor)) @@ -1151,19 +1151,19 @@ (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) jvm.var) - #.None + {.#None} actualJC)))) (list.zipped/2 parameters inputsJT)))))) (def: index_parameter (-> Nat .Type) - (|>> (n.* 2) ++ #.Parameter)) + (|>> (n.* 2) ++ {.#Parameter})) (def: (jvm_type_var_mapping owner_tvars method_tvars) (-> (List Text) (List Text) [(List .Type) Mapping]) @@ -1183,20 +1183,20 @@ (-> Method_Style java/lang/reflect/Method (Operation Method_Signature)) (let [owner (java/lang/reflect/Method::getDeclaringClass method) owner_tvars (case method_style - #Static + {#Static} (list) _ (|> (java/lang/Class::getTypeParameters owner) - (array.list #.None) + (array.list {.#None}) (list\each (|>> java/lang/reflect/TypeVariable::getName)))) method_tvars (|> (java/lang/reflect/Method::getTypeParameters method) - (array.list #.None) + (array.list {.#None}) (list\each (|>> java/lang/reflect/TypeVariable::getName))) [owner_tvarsT mapping] (jvm_type_var_mapping owner_tvars method_tvars)] (do [! phase.monad] [inputsT (|> (java/lang/reflect/Method::getGenericParameterTypes method) - (array.list #.None) + (array.list {.#None}) (monad.each ! (|>> reflection!.type phase.lifted)) (phase\each (monad.each ! (..reflection_type mapping))) phase\conjoint) @@ -1207,17 +1207,17 @@ (phase\each (..reflection_return mapping)) phase\conjoint) exceptionsT (|> (java/lang/reflect/Method::getGenericExceptionTypes method) - (array.list #.None) + (array.list {.#None}) (monad.each ! (|>> reflection!.type phase.lifted)) (phase\each (monad.each ! (..reflection_type mapping))) phase\conjoint) .let [methodT (<| (type.univ_q (dictionary.size mapping)) (type.function (case method_style - #Static + {#Static} inputsT _ - (list& {#.Primitive (java/lang/Class::getName owner) owner_tvarsT} + (list& {.#Primitive (java/lang/Class::getName owner) owner_tvarsT} inputsT))) outputT)]] (in [methodT @@ -1228,24 +1228,24 @@ (-> (java/lang/reflect/Constructor java/lang/Object) (Operation Method_Signature)) (let [owner (java/lang/reflect/Constructor::getDeclaringClass constructor) owner_tvars (|> (java/lang/Class::getTypeParameters owner) - (array.list #.None) + (array.list {.#None}) (list\each (|>> java/lang/reflect/TypeVariable::getName))) method_tvars (|> (java/lang/reflect/Constructor::getTypeParameters constructor) - (array.list #.None) + (array.list {.#None}) (list\each (|>> java/lang/reflect/TypeVariable::getName))) [owner_tvarsT mapping] (jvm_type_var_mapping owner_tvars method_tvars)] (do [! phase.monad] [inputsT (|> (java/lang/reflect/Constructor::getGenericParameterTypes constructor) - (array.list #.None) + (array.list {.#None}) (monad.each ! (|>> reflection!.type phase.lifted)) (phase\each (monad.each ! (reflection_type mapping))) phase\conjoint) exceptionsT (|> (java/lang/reflect/Constructor::getGenericExceptionTypes constructor) - (array.list #.None) + (array.list {.#None}) (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)]] @@ -1262,10 +1262,10 @@ [(def: <name> (-> Evaluation (Maybe Method_Signature)) (|>> (case> {<tag> output} - {#.Some output} + {.#Some output} _ - #.None)))] + {.#None})))] [pass! #Pass] [hint! #Hint] @@ -1275,7 +1275,7 @@ [(def: <name> (-> <type> (List (Type Var))) (|>> <method> - (array.list #.None) + (array.list {.#None}) (list\each (|>> java/lang/reflect/TypeVariable::getName jvm.var))))] [class_type_variables (java/lang/Class java/lang/Object) java/lang/Class::getTypeParameters] @@ -1296,7 +1296,7 @@ .let [expected_class_tvars (class_type_variables class)] candidates (|> class java/lang/Class::getDeclaredMethods - (array.list #.None) + (array.list {.#None}) (list.only (|>> java/lang/reflect/Method::getName (text\= method_name))) (monad.each ! (: (-> java/lang/reflect/Method (Operation Evaluation)) (function (_ method) @@ -1306,14 +1306,14 @@ (..aliasing expected_method_tvars actual_method_tvars))] passes? (check_method aliasing class method_name method_style inputsJT method)] (\ ! each (if passes? - (|>> #Pass) - (|>> #Hint)) + (|>> {#Pass}) + (|>> {#Hint})) (method_signature method_style method)))))))] (case (list.all pass! candidates) - {#.Item method #.End} + {.#Item method {.#End}} (in method) - #.End + {.#End} (/////analysis.except ..no_candidates [class_name method_name inputsJT (list.all hint! candidates)]) candidates @@ -1329,7 +1329,7 @@ .let [expected_class_tvars (class_type_variables class)] candidates (|> class java/lang/Class::getConstructors - (array.list #.None) + (array.list {.#None}) (monad.each ! (function (_ constructor) (do ! [.let [expected_method_tvars (constructor_type_variables constructor) @@ -1337,13 +1337,15 @@ (..aliasing expected_method_tvars actual_method_tvars))] passes? (check_constructor aliasing class inputsJT constructor)] (\ ! each - (if passes? (|>> #Pass) (|>> #Hint)) + (if passes? + (|>> {#Pass}) + (|>> {#Hint})) (constructor_signature constructor))))))] (case (list.all pass! candidates) - {#.Item constructor #.End} + {.#Item constructor {.#End}} (in constructor) - #.End + {.#End} (/////analysis.except ..no_candidates [class_name ..constructor_method inputsJT (list.all hint! candidates)]) candidates @@ -1382,12 +1384,12 @@ (do phase.monad [_ (..ensure_fresh_class! class_loader class) .let [argsT (list\each product.left argsTC)] - [methodT deprecated? exceptionsT] (..method_candidate class_loader class_tvars class method_tvars method #Static argsT) + [methodT deprecated? exceptionsT] (..method_candidate class_loader class_tvars class method_tvars method {#Static} argsT) _ (phase.assertion ..deprecated_method [class method methodT] (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))})))])) @@ -1400,18 +1402,18 @@ (do phase.monad [_ (..ensure_fresh_class! class_loader class) .let [argsT (list\each product.left argsTC)] - [methodT deprecated? exceptionsT] (..method_candidate class_loader class_tvars class method_tvars method #Virtual argsT) + [methodT deprecated? exceptionsT] (..method_candidate class_loader class_tvars class method_tvars method {#Virtual} argsT) _ (phase.assertion ..deprecated_method [class method methodT] (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 @@ -1425,12 +1427,12 @@ (do phase.monad [_ (..ensure_fresh_class! class_loader class) .let [argsT (list\each product.left argsTC)] - [methodT deprecated? exceptionsT] (..method_candidate class_loader class_tvars class method_tvars method #Special argsT) + [methodT deprecated? exceptionsT] (..method_candidate class_loader class_tvars class method_tvars method {#Special} argsT) _ (phase.assertion ..deprecated_method [class method methodT] (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))})))])) @@ -1446,18 +1448,18 @@ class (phase.lifted (reflection!.load class_loader class_name)) _ (phase.assertion non_interface class_name (java/lang/reflect/Modifier::isInterface (java/lang/Class::getModifiers class))) - [methodT deprecated? exceptionsT] (..method_candidate class_loader class_tvars class_name method_tvars method #Interface argsT) + [methodT deprecated? exceptionsT] (..method_candidate class_loader class_tvars class_name method_tvars method {#Interface} argsT) _ (phase.assertion ..deprecated_method [class_name method methodT] (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 + (in {/////analysis.#Extension extension_name (list& (/////analysis.text (..signature (jvm.class class_name (list)))) (/////analysis.text method) (/////analysis.text (..signature outputJT)) @@ -1476,7 +1478,7 @@ _ (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)))) + (in {/////analysis.#Extension extension_name (list& (/////analysis.text (..signature (jvm.class class (list)))) (decorate_inputs argsT argsA))})))])) (def: (bundle::member class_loader) @@ -1554,23 +1556,23 @@ (-> (java/lang/Class java/lang/Object) (Try (List [Text (Type Method)]))) (|>> java/lang/Class::getDeclaredMethods - (array.list #.None) + (array.list {.#None}) <only> (monad.each try.monad (function (_ method) (do [! try.monad] [.let [type_variables (|> (java/lang/reflect/Method::getTypeParameters method) - (array.list #.None) + (array.list {.#None}) (list\each (|>> java/lang/reflect/TypeVariable::getName jvm.var)))] inputs (|> (java/lang/reflect/Method::getGenericParameterTypes method) - (array.list #.None) + (array.list {.#None}) (monad.each ! reflection!.type)) return (|> method java/lang/reflect/Method::getGenericReturnType reflection!.return) exceptions (|> (java/lang/reflect/Method::getGenericExceptionTypes method) - (array.list #.None) + (array.list {.#None}) (monad.each ! reflection!.class))] (in [(java/lang/reflect/Method::getName method) (jvm.method [type_variables inputs return exceptions])]))))))] @@ -1607,10 +1609,10 @@ (type: .public Visibility (Variant - #Public - #Private - #Protected - #Default)) + {#Public} + {#Private} + {#Protected} + {#Default})) (type: .public Finality Bit) (type: .public Strictness Bit) @@ -1631,10 +1633,10 @@ (def: .public (visibility_analysis visibility) (-> Visibility Analysis) (/////analysis.text (case visibility - #Public ..public_tag - #Private ..private_tag - #Protected ..protected_tag - #Default ..default_tag))) + {#Public} ..public_tag + {#Private} ..private_tag + {#Protected} ..protected_tag + {#Default} ..default_tag))) (type: .public (Constructor a) [Visibility @@ -1693,7 +1695,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,7 +1709,7 @@ (/////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))} @@ -1769,7 +1771,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,7 +1787,7 @@ (/////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))} @@ -1857,7 +1859,7 @@ (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))} @@ -1914,10 +1916,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} - #.None))) + {.#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) @@ -1931,7 +1933,7 @@ (\ ! each (|>> (list.zipped/2 parent_parameters))))) (phase.lifted (exception.except ..mismatched_super_parameters [parent_name expected_count actual_count])))) - #.None + {.#None} (phase.lifted (exception.except ..unknown_super [parent_name supers]))))) (def: .public (with_fresh_type_vars vars mapping) @@ -1966,23 +1968,23 @@ bodyA 2 - {#/////analysis.Case (/////analysis.unit) - [[#/////analysis.when - {#/////analysis.Bind 2} + {/////analysis.#Case (/////analysis.unit) + [[/////analysis.#when + {/////analysis.#Bind 2} - #/////analysis.then + /////analysis.#then bodyA] (list)]} _ - {#/////analysis.Case (/////analysis.unit) - [[#/////analysis.when - {#/////analysis.Complex - {#/////analysis.Tuple (|> arity + {/////analysis.#Case (/////analysis.unit) + [[/////analysis.#when + {/////analysis.#Complex + {/////analysis.#Tuple (|> arity list.indices - (list\each (|>> (n.+ 2) #/////analysis.Bind)))}} + (list\each (|>> (n.+ 2) {/////analysis.#Bind})))}} - #/////analysis.then + /////analysis.#then bodyA] (list)]}))) @@ -2012,7 +2014,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,7 +2030,7 @@ (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)} @@ -2074,7 +2076,7 @@ [.let [[name actual_parameters] (jvm_parser.read_class class)] class (phase.lifted (reflection!.load class_loader name)) .let [expected_parameters (|> (java/lang/Class::getTypeParameters class) - (array.list #.None) + (array.list {.#None}) (list\each (|>> java/lang/reflect/TypeVariable::getName)))] _ (phase.assertion ..class_parameter_mismatch [expected_parameters actual_parameters] (n.= (list.size expected_parameters) @@ -2082,10 +2084,10 @@ (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 + {.#None} mapping)) jvm_alias.fresh))))) @@ -2154,7 +2156,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,10 +2167,10 @@ (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 + (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+)) 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 c9c1dfb0b..beb9ac7c4 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,7 +128,7 @@ [objectA (analysis/type.with_type ..Object (phase archive objectC)) _ (analysis/type.infer .Any)] - (in {#analysis.Extension extension (list (analysis.text fieldC) + (in {analysis.#Extension extension (list (analysis.text fieldC) objectA)})))])) (def: object::do @@ -141,7 +141,7 @@ (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)})))])) @@ -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,7 +232,7 @@ abstractionA (analysis/type.with_type (-> inputT Any) (phase archive abstractionC)) _ (analysis/type.infer ..Function)] - (in {#analysis.Extension extension (list (analysis.nat arity) + (in {analysis.#Extension extension (list (analysis.nat arity) abstractionA)})))])) (def: .public 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 0609bee0a..e1c23ed0d 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 16717539b..0aa12b4be 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,7 +138,7 @@ [objectA (analysis/type.with_type ..Object (phase archive objectC)) _ (analysis/type.infer .Any)] - (in {#analysis.Extension extension (list (analysis.text fieldC) + (in {analysis.#Extension extension (list (analysis.text fieldC) objectA)})))])) (def: object::do @@ -151,7 +151,7 @@ (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)})))])) @@ -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 ec21b45bc..385150e03 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,7 +136,7 @@ [objectA (analysis/type.with_type ..Object (phase archive objectC)) _ (analysis/type.infer .Any)] - (in {#analysis.Extension extension (list (analysis.text fieldC) + (in {analysis.#Extension extension (list (analysis.text fieldC) objectA)})))])) (def: object::do @@ -149,7 +149,7 @@ (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)})))])) @@ -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,7 +203,7 @@ abstractionA (analysis/type.with_type (-> inputT Any) (phase archive abstractionC)) _ (analysis/type.infer ..Function)] - (in {#analysis.Extension extension (list (analysis.nat arity) + (in {analysis.#Extension extension (list (analysis.nat arity) abstractionA)})))])) (def: python::exec @@ -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 525458cdd..7a8eda597 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,7 +128,7 @@ [objectA (analysis/type.with_type ..Object (phase archive objectC)) _ (analysis/type.infer .Any)] - (in {#analysis.Extension extension (list (analysis.text fieldC) + (in {analysis.#Extension extension (list (analysis.text fieldC) objectA)})))])) (def: object::do @@ -141,7 +141,7 @@ (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)})))])) @@ -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 a0df81d93..1dd6d0ca0 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 76c66e37d..a4c026cb4 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 @@ -171,9 +171,9 @@ (def: (constraint name) (-> Text Constraint) - [#type.name name - #type.super_class (type.class "java.lang.Object" (list)) - #type.super_interfaces (list)]) + [type.#name name + type.#super_class (type.class "java.lang.Object" (list)) + type.#super_interfaces (list)]) (def: constant::modifier (Modifier field.Field) @@ -194,15 +194,15 @@ [constant (`` (|> value (~~ (template.spliced <constant>)))) attribute (attribute.constant constant)] (field.field ..constant::modifier name <type> (row.row attribute)))]) - ([#.Bit type.boolean [(case> #0 +0 #1 +1) .i64 i32.i32 constant.integer pool.integer]] - [#.Int type.byte [.i64 i32.i32 constant.integer pool.integer]] - [#.Int type.short [.i64 i32.i32 constant.integer pool.integer]] - [#.Int type.int [.i64 i32.i32 constant.integer pool.integer]] - [#.Int type.long [constant.long pool.long]] - [#.Frac type.float [host.double_to_float constant.float pool.float]] - [#.Frac type.double [constant.double pool.double]] - [#.Nat type.char [.i64 i32.i32 constant.integer pool.integer]] - [#.Text (type.class "java.lang.String" (list)) [pool.string]] + ([.#Bit type.boolean [(case> #0 +0 #1 +1) .i64 i32.i32 constant.integer pool.integer]] + [.#Int type.byte [.i64 i32.i32 constant.integer pool.integer]] + [.#Int type.short [.i64 i32.i32 constant.integer pool.integer]] + [.#Int type.int [.i64 i32.i32 constant.integer pool.integer]] + [.#Int type.long [constant.long pool.long]] + [.#Frac type.float [host.double_to_float constant.float pool.float]] + [.#Frac type.double [constant.double pool.double]] + [.#Nat type.char [.i64 i32.i32 constant.integer pool.integer]] + [.#Text (type.class "java.lang.String" (list)) [pool.string]] ) ... TODO: Tighten this pattern-matching so this catch-all clause isn't necessary. @@ -275,13 +275,13 @@ (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) - .let [analyse (value@ [#directive.analysis #directive.phase] state) - synthesize (value@ [#directive.synthesis #directive.phase] state) - generate (value@ [#directive.generation #directive.phase] state)] + .let [analyse (value@ [directive.#analysis directive.#phase] state) + synthesize (value@ [directive.#synthesis directive.#phase] state) + generate (value@ [directive.#generation directive.#phase] state)] methods (monad.each ! (..method_definition [mapping selfT] [analyse synthesize generate]) methods) ... _ (directive.lifted_generation 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 95775c22a..fdd576cdc 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]) @@ -87,9 +87,9 @@ (-> Archive Type Code (Operation anchor expression directive [Type expression Any]))) (do phase.monad [state (///.lifted phase.get_state) - .let [analyse (value@ [#/////directive.analysis #/////directive.phase] state) - synthesize (value@ [#/////directive.synthesis #/////directive.phase] state) - generate (value@ [#/////directive.generation #/////directive.phase] state)] + .let [analyse (value@ [/////directive.#analysis /////directive.#phase] state) + synthesize (value@ [/////directive.#synthesis /////directive.#phase] state) + generate (value@ [/////directive.#generation /////directive.#phase] state)] [_ codeA] (/////directive.lifted_analysis (/////analysis.with_scope (typeA.with_fresh_env @@ -113,8 +113,8 @@ [codeG (generate archive codeS) id (/////generation.learn name) module_id (phase.lifted (archive.id module archive)) - [target_name value directive] (/////generation.define! [module_id id] #.None codeG) - _ (/////generation.save! id #.None directive)] + [target_name value directive] (/////generation.define! [module_id id] {.#None} codeG) + _ (/////generation.save! id {.#None} directive)] (in [code//type codeG value])))) (def: (definition archive name expected codeC) @@ -123,14 +123,14 @@ (Operation anchor expression directive [Type expression Any]))) (do [! phase.monad] [state (///.lifted phase.get_state) - .let [analyse (value@ [#/////directive.analysis #/////directive.phase] state) - synthesize (value@ [#/////directive.synthesis #/////directive.phase] state) - generate (value@ [#/////directive.generation #/////directive.phase] state)] + .let [analyse (value@ [/////directive.#analysis /////directive.#phase] state) + synthesize (value@ [/////directive.#synthesis /////directive.#phase] state) + generate (value@ [/////directive.#generation /////directive.#phase] state)] [_ code//type codeA] (/////directive.lifted_analysis (/////analysis.with_scope (typeA.with_fresh_env (case expected - #.None + {.#None} (do ! [[code//type codeA] (typeA.with_inference (analyse archive codeC)) @@ -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))] @@ -165,8 +165,8 @@ [codeG (generate archive codeS) module_id (phase.lifted (archive.id current_module archive)) id (<learn> extension) - [target_name value directive] (/////generation.define! [module_id id] #.None codeG) - _ (/////generation.save! id #.None directive)] + [target_name value directive] (/////generation.define! [module_id id] {.#None} codeG) + _ (/////generation.save! id {.#None} directive)] (in [codeG value]))))) (def: .public (<full> archive extension codeT codeC) @@ -175,9 +175,9 @@ (Operation anchor expression directive [expression Any]))) (do phase.monad [state (///.lifted phase.get_state) - .let [analyse (value@ [#/////directive.analysis #/////directive.phase] state) - synthesize (value@ [#/////directive.synthesis #/////directive.phase] state) - generate (value@ [#/////directive.generation #/////directive.phase] state)] + .let [analyse (value@ [/////directive.#analysis /////directive.#phase] state) + synthesize (value@ [/////directive.#synthesis /////directive.#phase] state) + generate (value@ [/////directive.#generation /////directive.#phase] state)] [_ codeA] (/////directive.lifted_analysis (/////analysis.with_scope (typeA.with_fresh_env @@ -199,11 +199,11 @@ (do phase.monad [[bundle state] phase.get_state .let [eval (/////analysis/evaluation.evaluator expander - (value@ [#/////directive.synthesis #/////directive.state] state) - (value@ [#/////directive.generation #/////directive.state] state) - (value@ [#/////directive.generation #/////directive.phase] state))]] + (value@ [/////directive.#synthesis /////directive.#state] state) + (value@ [/////directive.#generation /////directive.#state] state) + (value@ [/////directive.#generation /////directive.#phase] state))]] (phase.set_state [bundle - (revised@ [#/////directive.analysis #/////directive.state] + (revised@ [/////directive.#analysis /////directive.#state] (: (-> /////analysis.State+ /////analysis.State+) (|>> product.right [(///analysis.bundle eval host_analysis)])) @@ -219,15 +219,15 @@ (-> 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)) .let [full_name [current_module short_name]] - [type valueT value] (..definition archive full_name #.None valueC) + [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)) @@ -241,7 +241,7 @@ (/////directive.lifted_generation (monad.each phase.monad (function (_ tag) - (/////generation.log! (format "#" tag " : Tag of " (%.type owner)))) + (/////generation.log! (format tag " : Tag of " (%.type owner)))) tags))) (def: (def::type_tagged expander host_analysis) @@ -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]}) + {.#End} + (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) @@ -302,8 +302,8 @@ "" (in []) _ (module.alias alias module)))) imports))] - (in [#/////directive.imports imports - #/////directive.referrals (list)])))])) + (in [/////directive.#imports imports + /////directive.#referrals (list)])))])) (exception: .public (cannot_alias_an_alias [local Alias foreign Alias @@ -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 @@ -343,8 +343,8 @@ (function (_ extension_name phase archive [alias def_name]) (do phase.monad [_ (///.lifted - (phase.sub [(value@ [#/////directive.analysis #/////directive.state]) - (with@ [#/////directive.analysis #/////directive.state])] + (phase.sub [(value@ [/////directive.#analysis /////directive.#state]) + (with@ [/////directive.#analysis /////directive.#state])] (define_alias alias def_name)))] (in /////directive.no_requirements)))])) @@ -428,7 +428,7 @@ (do phase.monad [programG (generate archive programS) artifact_id (/////generation.learn /////program.name)] - (/////generation.save! artifact_id #.None (program [module_id artifact_id] programG)))) + (/////generation.save! artifact_id {.#None} (program [module_id artifact_id] programG)))) (def: (def::program program) (All (_ anchor expression directive) @@ -438,9 +438,9 @@ (^ (list programC)) (do phase.monad [state (///.lifted phase.get_state) - .let [analyse (value@ [#/////directive.analysis #/////directive.phase] state) - synthesize (value@ [#/////directive.synthesis #/////directive.phase] state) - generate (value@ [#/////directive.generation #/////directive.phase] state)] + .let [analyse (value@ [/////directive.#analysis /////directive.#phase] state) + synthesize (value@ [/////directive.#synthesis /////directive.#phase] state) + generate (value@ [/////directive.#generation /////directive.#phase] state)] programS (prepare_program archive analyse synthesize programC) current_module (/////directive.lifted_analysis (///.lifted meta.current_module_name)) 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 8c6df79fd..aec90687b 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 54b345e36..de36c0766 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))) @@ -121,8 +121,8 @@ (^template [<tag>] [(^ {<tag> value}) (/////\each _.return (expression archive synthesis))]) - ([#synthesis.Reference] - [#synthesis.Extension]) + ([synthesis.#Reference] + [synthesis.#Extension]) (^ (synthesis.branch/case case)) (//case.case! statement expression archive case) @@ -166,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 f3efd5f47..cb63e2a33 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 b070a0a6b..8784ae034 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,15 +339,15 @@ (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 + {.#None} (<>.failure (exception.error ..not_an_object_array arrayJT))) - #.None + {.#None} (undefined)))) (def: (primitive_array_length_handler jvm_primitive) @@ -644,10 +644,10 @@ (do //////.monad [.let [$class (type.class class (list))]] (case (dictionary.value unboxed ..primitives) - {#.Some primitive} + {.#Some primitive} (in (_.getstatic $class field primitive)) - #.None + {.#None} (in (_.getstatic $class field (type.class unboxed (list)))))))])) (def: unitG (_.string //////synthesis.unit)) @@ -661,13 +661,13 @@ [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) ..unitG)) - #.None + {.#None} (in ($_ _.composite valueG (_.checkcast $class) @@ -683,10 +683,10 @@ [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 + {.#None} (_.getfield $class field (type.class unboxed (list))))]] (in ($_ _.composite objectG @@ -703,10 +703,10 @@ 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 + {.#None} (let [$unboxed (type.class unboxed (list))] ($_ _.composite (_.checkcast $unboxed) @@ -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 @@ -857,15 +857,15 @@ (^template [<tag>] [(^ {<tag> leftP rightP}) {<tag> (recur leftP) (recur rightP)}]) - ([#//////synthesis.Alt] - [#//////synthesis.Seq]) + ([//////synthesis.#Alt] + [//////synthesis.#Seq]) (^template [<tag>] - [(^ {<tag> value}) + [(^ {<tag> _}) path]) - ([#//////synthesis.Pop] - [#//////synthesis.Bind] - [#//////synthesis.Access]) + ([//////synthesis.#Pop] + [//////synthesis.#Bind] + [//////synthesis.#Access]) _ (undefined)))) @@ -877,7 +877,7 @@ (^template [<tag>] [(^ {<tag> value}) body]) - ([#//////synthesis.Primitive] + ([//////synthesis.#Primitive] [//////synthesis.constant]) (^ (//////synthesis.variant [lefts right? sub])) @@ -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,7 +952,7 @@ (_.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)])) @@ -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,7 +1066,7 @@ returnT exceptionsT]) (list) - {#.Some ($_ _.composite + {.#Some ($_ _.composite bodyG (returnG returnT))})))) normalized_methods) 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 3523c19fa..1de9c4057 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))) @@ -81,8 +81,8 @@ (^template [<tag>] [(^ {<tag> value}) (/////\each _.return (expression archive synthesis))]) - ([#synthesis.Reference] - [#synthesis.Extension]) + ([synthesis.#Reference] + [synthesis.#Extension]) (^ (synthesis.branch/case case)) (//case.case! statement expression archive 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 9a06cd980..131f8e57e 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 cbb7c557d..d06f428a6 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))) @@ -67,8 +67,8 @@ (^template [<tag>] [(^ {<tag> value}) (/////\each _.return (expression archive synthesis))]) - ([#synthesis.Reference] - [#synthesis.Extension]) + ([synthesis.#Reference] + [synthesis.#Extension]) (^ (synthesis.branch/case case)) (//case.case! false statement expression archive case) @@ -92,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 @@ -128,7 +128,7 @@ ... .let [dependencies (//case.dependencies (list\mix (function (_ right left) ... (synthesis.path/seq left right)) ... (synthesis.path/then input) - ... {#.Item (synthesis.path/then else) + ... {.#Item (synthesis.path/then else) ... (list\each (|>> product.right ... synthesis.path/then) ... conditionals)})) @@ -141,7 +141,7 @@ ... else! ... conditionals!)))] ... _ (generation.execute! closure) - ... _ (generation.save! (product.right artifact_id) #.None closure) + ... _ (generation.save! (product.right artifact_id) {.#None} closure) ] ... (in (_.apply/* @closure dependencies)) (in (<| (:as (Expression Any)) 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 2e533b5bd..1db4fb268 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 6b6538363..f057e6e10 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 @@ -79,8 +79,8 @@ (^template [<tag>] [(^ {<tag> value}) (/////\each _.return (expression archive synthesis))]) - ([#synthesis.Reference] - [#synthesis.Extension]) + ([synthesis.#Reference] + [synthesis.#Extension]) (^ (synthesis.branch/case case)) (//case.case! false statement expression archive case) @@ -123,7 +123,7 @@ _.nil)) branch!]))) conditionals)) - ... .let [closure (_.lambda #.None (list @input) + ... .let [closure (_.lambda {.#None} (list @input) ... (list\mix (function (_ [test then] else) ... (_.if test (_.return then) else)) ... (_.return else!) 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 7161326e1..e786087d1 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 26a967a45..dca5d6673 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 5442b7268..ed9bd19a0 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 @@ -68,8 +68,8 @@ (^template [<side> <accessor>] [(<side> lefts) (<accessor> (_.int (.int lefts)))]) - ([#.Left //runtime.tuple//left] - [#.Right //runtime.tuple//right]))] + ([.#Left //runtime.tuple//left] + [.#Right //runtime.tuple//right]))] (method source))) valueG pathP)))) @@ -117,10 +117,10 @@ (_.go @fail) (..push! @temp))) (.case next! - {#.Some next!} + {.#Some next!} (list next!) - #.None + {.#None} (list))))))] [left_choice _.nil (<|)] @@ -147,20 +147,20 @@ (_.go @done)))) (expression archive bodyS)) - #/////synthesis.Pop + {/////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 + {.#None} (in (_.go @fail)))] (in (.if when (_.if ..peek @@ -179,23 +179,23 @@ (in [(<=> [(|> match <format>) ..peek]) then!]))) - {#.Item item})] + {.#Item item})] (in (list\mix (function (_ [when then] else) (_.if when then else)) (_.go @fail) clauses)))]) - ([#/////synthesis.I64_Fork //primitive.i64 _.=/2] - [#/////synthesis.F64_Fork //primitive.f64 _.=/2] - [#/////synthesis.Text_Fork //primitive.text _.string=/2]) + ([/////synthesis.#I64_Fork //primitive.i64 _.=/2] + [/////synthesis.#F64_Fork //primitive.f64 _.=/2] + [/////synthesis.#Text_Fork //primitive.text _.string=/2]) (^template [<complex> <simple> <choice>] [(^ (<complex> idx)) - (///////phase\in (<choice> @fail false idx #.None)) + (///////phase\in (<choice> @fail false idx {.#None})) (^ (<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]) @@ -248,7 +248,7 @@ pattern_matching! (pattern_matching $output expression archive pathP) .let [storage (|> pathP ////synthesis/case.storage - (value@ #////synthesis/case.bindings) + (value@ ////synthesis/case.#bindings) set.list (list\each (function (_ register) [(..register register) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux index 5f38c7bad..3130f0121 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux @@ -43,7 +43,7 @@ (def: (with_closure inits function_definition) (-> (List (Expression Any)) (Expression Any) (Operation (Expression Any))) (case inits - #.End + {.#End} (\ ///////phase.monad in function_definition) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux index bae37c835..18bbc788e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux @@ -36,7 +36,7 @@ (Generator (Scope Synthesis)) (case initsS+ ... function/false/non-independent loop - #.End + {.#End} (expression archive bodyS) ... true loop 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 1c7fd4877..2cee2de25 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 2a5fa7c1c..22ed7a7c6 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 @@ -17,10 +17,10 @@ (def: .public (tuple expression archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ - #.End + {.#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 65b06ce16..24db5395a 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 8f98d44ab..246bcb54d 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 @@ -82,8 +82,8 @@ (^template [<side> <accessor>] [(<side> lefts) (<accessor> (_.i32 (.int lefts)))]) - ([#.Left //runtime.tuple//left] - [#.Right //runtime.tuple//right]))] + ([.#Left //runtime.tuple//left] + [.#Right //runtime.tuple//right]))] (method source))) valueO (list.reversed pathP))))) @@ -166,12 +166,12 @@ [(^ (<simple> idx nextP)) (|> nextP recur - (\ ///////phase.monad each (|>> (_.then (<choice> true idx)) #.Some)))]) + (\ ///////phase.monad each (|>> (_.then (<choice> true idx)) {.#Some})))]) ([/////synthesis.simple_left_side ..left_choice] [/////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,7 +179,7 @@ (/////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!)})) @@ -190,7 +190,7 @@ (/////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!)}))]) ([/////synthesis.member/left //runtime.tuple//left] @@ -199,7 +199,7 @@ (^ (/////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!)})) @@ -207,12 +207,12 @@ (.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!)}))) _ - (///////phase\in #.None))) + (///////phase\in {.#None}))) (def: (pattern_matching' statement expression archive) (-> Phase! Phase Archive @@ -221,28 +221,28 @@ (do ///////phase.monad [outcome (optimized_pattern_matching recur pathP)] (.case outcome - {#.Some outcome} + {.#Some outcome} (in outcome) - #.None + {.#None} (.case pathP - {#/////synthesis.Then bodyS} + {/////synthesis.#Then bodyS} (statement expression archive bodyS) - #/////synthesis.Pop + {/////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 + {.#None} (in ..fail_pm!))] (in (.if when (_.if ..peek_cursor @@ -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,20 +260,20 @@ (in [(//runtime.i64//= (//primitive.i64 (.int match)) ..peek_cursor) then!]))) - {#.Item item})] + {.#Item item})] (in (_.cond clauses ..fail_pm!))) (^template [<tag> <format>] - [(<tag> item) + [{<tag> item} (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!})))]) - ([#/////synthesis.F64_Fork //primitive.f64] - [#/////synthesis.Text_Fork //primitive.text]) + {.#Some ..fail_pm!})))]) + ([/////synthesis.#F64_Fork //primitive.f64] + [/////synthesis.#Text_Fork //primitive.text]) (^template [<complex> <choice>] [(^ (<complex> idx)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux index f9e8d9c10..57083f023 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux @@ -41,7 +41,7 @@ (def: (with_closure @self inits body!) (-> Var (List Expression) Statement [Statement Expression]) (case inits - #.End + {.#End} [(_.function! @self (list) body!) @self] @@ -119,5 +119,5 @@ @self)))))))) ))] _ (/////generation.execute! definition) - _ (/////generation.save! (product.right function_name) #.None definition)] + _ (/////generation.save! (product.right function_name) {.#None} definition)] (in instantiation))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux index 52600eaeb..cde2c64a7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux @@ -45,7 +45,7 @@ (Generator! (Scope Synthesis)) (case initsS+ ... function/false/non-independent loop - #.End + {.#End} (statement expression archive bodyS) ... true loop @@ -64,7 +64,7 @@ (-> Phase! (Generator (Scope Synthesis))) (case initsS+ ... function/false/non-independent loop - #.End + {.#End} (expression archive bodyS) ... true loop 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 f2be9fda5..b83068e2b 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)] @@ -775,12 +775,12 @@ (Operation [Registry Output]) (do ///////phase.monad [_ (/////generation.execute! ..runtime) - _ (/////generation.save! ..module_id #.None ..runtime)] + _ (/////generation.save! ..module_id {.#None} ..runtime)] (in [(|> artifact.empty artifact.resource product.right) (row.row [..module_id - #.None + {.#None} (|> ..runtime _.code (\ utf8.codec encoded))])]))) 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 88072200f..d5838b04b 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 @@ -17,10 +17,10 @@ (def: .public (tuple generate archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ - #.End + {.#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 6a1a607cb..738700655 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 2da725141..3493c8140 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 @@ -92,15 +92,15 @@ (def: (path' stack_depth @else @end phase archive path) (-> Nat Label Label (Generator Path)) (.case path - #synthesis.Pop + {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 b0833504c..c0ab7b58d 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.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux index 0aa307c72..b046e78b8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux @@ -113,7 +113,7 @@ (row.row))) .let [bytecode (format.result class.writer class)] _ (generation.execute! [function_class bytecode]) - _ (generation.save! function_class #.None [function_class bytecode])] + _ (generation.save! function_class {.#None} [function_class bytecode])] (in instance))) (def: .public (apply generate archive [abstractionS inputsS]) 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 15a73026e..d9f9427a2 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]) 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 723ff6ce5..9a77e6a62 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,7 +31,7 @@ (method.method //.modifier name (..type arity) (list) - {#.Some ($_ _.composite + {.#Some ($_ _.composite (_.set_label @begin) body _.areturn 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 91df54eca..ecddbaf46 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,7 +94,7 @@ (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) 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 79926e5b8..105718c78 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) 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 b5bdb1e1d..791bca2f5 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,7 +43,7 @@ (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) 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 0ffbbceb3..e6db5b72c 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} - (case (java/lang/reflect/Field::get #.None field) - {#try.Success ?value} + {try.#Success field} + (case (java/lang/reflect/Field::get {.#None} field) + {try.#Success ?value} (case ?value - {#.Some value} - {#try.Success value} + {.#Some value} + {try.#Success value} - #.None + {.#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,7 +110,7 @@ (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) 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 9ed5eb48e..daf8fa2fc 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 4074cf6cc..cb5f99c33 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,7 +132,7 @@ (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 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 778b23005..c61f58336 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 c3c8f518c..eba8c2f00 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,7 +151,7 @@ (method.method ..modifier ..variant::name ..variant::type (list) - {#.Some ($_ _.composite + {.#Some ($_ _.composite new_variant ... A[3] (..set! ..variant_tag $tag) ... A[3] (..set! ..variant_last? $last?) ... A[3] @@ -213,7 +213,7 @@ (method.method ..modifier ..decode_frac::name ..decode_frac::type (list) - {#.Some + {.#Some (..risky ($_ _.composite _.aload_0 @@ -250,7 +250,7 @@ (method.method ..modifier name ..failure::type (list) - {#.Some + {.#Some ($_ _.composite (..illegal_state_exception message) _.athrow)})) @@ -272,7 +272,7 @@ (method.method ..modifier ..push::name ..push::type (list) - {#.Some + {.#Some (let [new_stack_frame! ($_ _.composite _.iconst_2 (_.anewarray //type.value)) @@ -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 @@ -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 @@ -413,7 +413,7 @@ right_projection::method (method.method ..modifier ..right_projection::name ..projection_type (list) - {#.Some + {.#Some (do _.monad [@loop _.new_label @not_tail _.new_label @@ -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 @@ -539,7 +539,7 @@ (row.row)))] (do ////.monad [_ (generation.execute! [class bytecode])] - (generation.save! ..artifact_id #.None [class bytecode])))) + (generation.save! ..artifact_id {.#None} [class bytecode])))) (def: generate_function (Operation Any) @@ -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))] @@ -563,10 +563,10 @@ (list& (method.method (modifier\composite method.public method.abstract) ..apply::name (..apply::type //function/arity.minimum) (list) - #.None))) + {.#None}))) <init>::method (method.method method.public "<init>" //function.init (list) - {#.Some + {.#Some (let [$partials _.iload_1] ($_ _.composite ..this @@ -596,7 +596,7 @@ (row.row)))] (do ////.monad [_ (generation.execute! [class bytecode])] - (generation.save! //function.artifact_id #.None [class bytecode])))) + (generation.save! //function.artifact_id {.#None} [class bytecode])))) (def: .public generate (Operation Any) 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 6b1a09aea..7455a3d3b 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 @@ -29,10 +29,10 @@ (def: .public (tuple generate archive membersS) (Generator (Tuple Synthesis)) (case membersS - #.End + {.#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 66472f114..44b40b6e9 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 7188a282c..90f2f3f3a 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 @@ -67,8 +67,8 @@ (^template [<side> <accessor>] [(<side> lefts) (<accessor> (_.int (.int lefts)))]) - ([#.Left //runtime.tuple//left] - [#.Right //runtime.tuple//right]))] + ([.#Left //runtime.tuple//left] + [.#Right //runtime.tuple//right]))] (method source))) valueO (list.reversed pathP))))) @@ -163,23 +163,23 @@ (-> Phase! Phase Archive Path (Operation Statement)) (function (recur pathP) (.case pathP - {#/////synthesis.Then bodyS} + {/////synthesis.#Then bodyS} (statement expression archive bodyS) - #/////synthesis.Pop + {/////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 + {.#None} (in ..fail!))] (in (.if when (_.if ..peek @@ -198,11 +198,11 @@ (in [(_.= (|> match <format>) ..peek) then!]))) - {#.Item item})] + {.#Item item})] (in (_.cond clauses ..fail!)))]) - ([#/////synthesis.I64_Fork (<| _.int .int)] - [#/////synthesis.F64_Fork _.float] - [#/////synthesis.Text_Fork _.string]) + ([/////synthesis.#I64_Fork (<| _.int .int)] + [/////synthesis.#F64_Fork _.float] + [/////synthesis.#Text_Fork _.string]) (^template [<complex> <simple> <choice>] [(^ (<complex> idx)) @@ -250,14 +250,14 @@ (def: .public dependencies (-> Path (List Var)) (|>> ////synthesis/case.storage - (value@ #////synthesis/case.dependencies) + (value@ ////synthesis/case.#dependencies) 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/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux index dbae0c91b..e395e1b19 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux @@ -43,7 +43,7 @@ (def: (with_closure inits @self @args body!) (-> (List Expression) Var (List Var) Statement [Statement Expression]) (case inits - #.End + {.#End} [(_.function @self @args body!) @self] @@ -133,5 +133,5 @@ (_.apply/1 @self)))))))) ))] _ (/////generation.execute! definition) - _ (/////generation.save! (product.right function_name) #.None definition)] + _ (/////generation.save! (product.right function_name) {.#None} definition)] (in instantiation))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux index 57b7261ff..bee7ac538 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux @@ -53,7 +53,7 @@ (Operation [(List Expression) Statement])) (case initsS+ ... function/false/non-independent loop - #.End + {.#End} (|> bodyS (statement expression archive) (\ ///////phase.monad each (|>> [(list)]))) @@ -75,7 +75,7 @@ (-> Phase! (Generator (Scope Synthesis))) (case initsS+ ... function/false/non-independent loop - #.End + {.#End} (expression archive bodyS) ... true loop @@ -93,7 +93,7 @@ (set.of_list _.hash) (set.difference (set.of_list _.hash locals)) set.list) - #.End + {.#End} [(_.function @loop locals scope!) @loop] @@ -108,7 +108,7 @@ )) (|> @context (_.apply/* foreigns))])))] _ (/////generation.execute! directive) - _ (/////generation.save! artifact_id #.None directive)] + _ (/////generation.save! artifact_id {.#None} directive)] (in (|> instantiation (_.apply/* initsO+)))))) (def: .public (recur! statement expression archive argsS+) 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 a6e448433..fa0a01ef7 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) @@ -422,12 +422,12 @@ (Operation [Registry Output]) (do ///////phase.monad [_ (/////generation.execute! ..runtime) - _ (/////generation.save! ..module_id #.None ..runtime)] + _ (/////generation.save! ..module_id {.#None} ..runtime)] (in [(|> artifact.empty artifact.resource product.right) (row.row [..module_id - #.None + {.#None} (|> ..runtime _.code (\ utf8.codec encoded))])]))) 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 29a909d0e..c2bd264e0 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 @@ -17,10 +17,10 @@ (def: .public (tuple generate archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ - #.End + {.#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 9c16f64cb..e2fc2ba88 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 @@ -39,10 +39,14 @@ [////synthesis.text] [////synthesis.variant] [////synthesis.tuple] - [#////synthesis.Reference] [////synthesis.branch/get] - [////synthesis.function/apply] - [#////synthesis.Extension]) + [////synthesis.function/apply]) + + (^template [<tag>] + [(^ {<tag> value}) + (//////phase\each _.return (expression archive synthesis))]) + ([////synthesis.#Reference] + [////synthesis.#Extension]) (^ (////synthesis.branch/case case)) (/case.case! statement expression archive case) @@ -72,7 +76,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 +99,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 a5532afc3..d6e4ccb15 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 @@ -88,8 +88,8 @@ (^template [<side> <accessor>] [(<side> lefts) (<accessor> (_.int (.int lefts)))]) - ([#.Left //runtime.tuple//left] - [#.Right //runtime.tuple//right]))] + ([.#Left //runtime.tuple//left] + [.#Right //runtime.tuple//right]))] (method source))) valueG (list.reversed pathP))))) @@ -163,23 +163,23 @@ (Generator! Path) (function (recur pathP) (.case pathP - {#/////synthesis.Then bodyS} + {/////synthesis.#Then bodyS} (statement expression archive bodyS) - #/////synthesis.Pop + {/////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 + {.#None} (in ..fail!))] (in (.if when (_.if ..peek @@ -198,11 +198,11 @@ (in [(_.=== (|> match <format>) ..peek) then!]))) - {#.Item item})] + {.#Item item})] (in (_.cond clauses ..fail!)))]) - ([#/////synthesis.I64_Fork //primitive.i64] - [#/////synthesis.F64_Fork //primitive.f64] - [#/////synthesis.Text_Fork //primitive.text]) + ([/////synthesis.#I64_Fork //primitive.i64] + [/////synthesis.#F64_Fork //primitive.f64] + [/////synthesis.#Text_Fork //primitive.text]) (^template [<complex> <simple> <choice>] [(^ (<complex> idx)) @@ -260,14 +260,14 @@ (def: .public dependencies (-> Path (List Var)) (|>> ////synthesis/case.storage - (value@ #////synthesis/case.dependencies) + (value@ ////synthesis/case.#dependencies) 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/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux index f630ec274..83e16e834 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux @@ -50,7 +50,7 @@ (def: (with_closure inits @selfG @selfL body!) (-> (List Expression) Global Var Statement [Statement Expression]) (case inits - #.End + {.#End} [($_ _.then (_.set! @selfL (_.closure (list (_.reference @selfL)) (list) body!)) (_.set! @selfG @selfL)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux index 055e107e0..7ce83fe85 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux @@ -51,7 +51,7 @@ (Generator! (Scope Synthesis)) (case initsS+ ... function/false/non-independent loop - #.End + {.#End} (statement expression archive bodyS) ... true loop @@ -70,7 +70,7 @@ (-> Phase! (Generator (Scope Synthesis))) (case initsS+ ... function/false/non-independent loop - #.End + {.#End} (expression archive bodyS) ... true loop @@ -92,7 +92,7 @@ (list\mix set.union (referenced_variables bodyS)) (set.difference loop_variables) set.list) - #.End + {.#End} [(_.define_function @loop (list) scope!) @loop] 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 d8a418657..81f608c20 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) @@ -317,9 +317,9 @@ (_.set! value (_.apply/1 op [..unit])) (_.return (..right value))) (list (with_vars [error] - [#_.class (_.constant "Exception") - #_.exception error - #_.handler (_.return (..left (_.do "getMessage" (list) error)))]))))) + [_.#class (_.constant "Exception") + _.#exception error + _.#handler (_.return (..left (_.do "getMessage" (list) error)))]))))) (runtime: (lux//program_args inputs) (with_vars [head tail] 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 cb499a364..8e1a366a8 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 @@ -20,10 +20,10 @@ (def: .public (tuple expression archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ - #.End + {.#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 b691c09d6..deca2222f 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 6cdabddd0..6b6e2ff74 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 @@ -93,8 +93,8 @@ (^template [<side> <accessor>] [(<side> lefts) (<accessor> (_.int (.int lefts)))]) - ([#.Left //runtime.tuple::left] - [#.Right //runtime.tuple::right]))] + ([.#Left //runtime.tuple::left] + [.#Right //runtime.tuple::right]))] (method source))) valueO (list.reversed pathP))))) @@ -156,14 +156,14 @@ (.if in_closure? (_.while (_.bool true) body! - #.None) + {.#None}) ($_ _.then (_.set (list g!once) (_.bool true)) (_.while g!once ($_ _.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,16 +179,16 @@ (-> (-> 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 + {.#None} (in ..fail_pm!))] - (in {#.Some (.if when + (in {.#Some (.if when (_.if ..peek then! else!) @@ -204,15 +204,15 @@ (|>> [(_.= (|> match <format>) ..peek)]) (recur then))) - {#.Item item})] - (in {#.Some (_.cond clauses + {.#Item item})] + (in {.#Some (_.cond clauses ..fail_pm!)}))]) - ([#/////synthesis.I64_Fork (<| //primitive.i64 .int)] - [#/////synthesis.F64_Fork (<| //primitive.f64)] - [#/////synthesis.Text_Fork (<| //primitive.text)]) + ([/////synthesis.#I64_Fork (<| //primitive.i64 .int)] + [/////synthesis.#F64_Fork (<| //primitive.f64)] + [/////synthesis.#Text_Fork (<| //primitive.text)]) _ - (\ ///////phase.monad in #.None))) + (\ ///////phase.monad in {.#None}))) (def: (pattern_matching' in_closure? statement expression archive) (-> Bit Phase! Phase Archive Path (Operation (Statement Any))) @@ -220,18 +220,18 @@ (do [! ///////phase.monad] [?output (primitive_pattern_matching recur pathP)] (.case ?output - {#.Some output} + {.#Some output} (in output) - #.None + {.#None} (.case pathP - {#/////synthesis.Then bodyS} + {/////synthesis.#Then bodyS} (statement expression archive bodyS) - #/////synthesis.Pop + {/////synthesis.#Pop} (///////phase\in ..pop!) - {#/////synthesis.Bind register} + {/////synthesis.#Bind register} (///////phase\in (_.set (list (..register register)) ..peek)) (^template [<complex> <simple> <choice>] @@ -298,14 +298,14 @@ (def: .public dependencies (-> Path (List SVar)) (|>> case.storage - (value@ #case.dependencies) + (value@ case.#dependencies) 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]) @@ -330,5 +330,5 @@ directive (_.def @case @dependencies+ pattern_matching!)] _ (/////generation.execute! directive) - _ (/////generation.save! case_artifact #.None directive)] + _ (/////generation.save! case_artifact {.#None} directive)] (in (_.apply/* @case @dependencies+)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux index fa9fc1656..bbb9fbd00 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux @@ -45,10 +45,10 @@ (def: (with_closure function_id @function inits function_definition) (-> artifact.ID SVar (List (Expression Any)) (Statement Any) (Operation (Expression Any))) (case inits - #.End + {.#End} (do ///////phase.monad [_ (/////generation.execute! function_definition) - _ (/////generation.save! function_id #.None function_definition)] + _ (/////generation.save! function_id {.#None} function_definition)] (in @function)) _ @@ -60,7 +60,7 @@ function_definition (_.return @function)))] _ (/////generation.execute! directive) - _ (/////generation.save! function_id #.None directive)] + _ (/////generation.save! function_id {.#None} directive)] (in (_.apply/* @function inits))))) (def: input diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux index b84826a26..066149a79 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux @@ -45,13 +45,13 @@ (-> (Statement Any) (Statement Any)) (_.while (_.bool true) body! - #.None)) + {.#None})) (def: .public (scope! statement expression archive [start initsS+ bodyS]) (Generator! (Scope Synthesis)) (case initsS+ ... function/false/non-independent loop - #.End + {.#End} (statement expression archive bodyS) ... true loop @@ -68,7 +68,7 @@ (-> Phase! (Generator (Scope Synthesis))) (case initsS+ ... function/false/non-independent loop - #.End + {.#End} (expression archive bodyS) ... true loop @@ -91,7 +91,7 @@ (set.of_list _.hash) (set.difference (set.of_list _.hash locals)) set.list) - #.End + {.#End} [actual_loop @loop] @@ -103,7 +103,7 @@ )) (_.apply/* @loop foreigns)]))] _ (/////generation.execute! directive) - _ (/////generation.save! loop_artifact #.None directive)] + _ (/////generation.save! loop_artifact {.#None} directive)] (in (_.apply/* instantiation initsO+))))) (def: .public (recur! statement expression archive argsS+) 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 c2055e2cc..e72faad54 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 @@ -220,7 +220,7 @@ (_.return (_.item lefts tuple)) ... Needs recursion <recur>)) - #.None))) + {.#None}))) (runtime: (tuple::right lefts tuple) (with_vars [last_index_right right_index] @@ -234,7 +234,7 @@ ... Needs recursion. <recur>]) (_.return (_.slice_from right_index tuple)))) - #.None)))) + {.#None})))) (runtime: (sum::get sum wantsLast wantedTag) (let [no_match! (_.return _.none) @@ -261,7 +261,7 @@ (_.return (variant' (_.- wantedTag sum_tag) sum_flag sum_value))]) no_match!) - #.None))) + {.#None}))) (def: runtime::adt (Statement Any) @@ -449,12 +449,12 @@ (Operation [Registry Output]) (do ///////phase.monad [_ (/////generation.execute! ..runtime) - _ (/////generation.save! ..module_id #.None ..runtime)] + _ (/////generation.save! ..module_id {.#None} ..runtime)] (in [(|> artifact.empty artifact.resource product.right) (row.row [..module_id - #.None + {.#None} (|> ..runtime _.code (\ utf8.codec encoded))])]))) 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 5950a81ff..86c429347 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 @@ -17,10 +17,10 @@ (def: .public (tuple generate archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ - #.End + {.#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 4e3e67097..5438a0266 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 15e9c75e5..e99973e60 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 @@ -71,8 +71,8 @@ (^template [<side> <accessor>] [(<side> lefts) (<accessor> (_.int (.int lefts)))]) - ([#.Left //runtime.tuple::left] - [#.Right //runtime.tuple::right]))] + ([.#Left //runtime.tuple::left] + [.#Right //runtime.tuple::right]))] (method source))) valueO (list.reversed pathP))))) @@ -135,23 +135,23 @@ (Generator Path) (function (recur pathP) (.case pathP - {#/////synthesis.Then bodyS} + {/////synthesis.#Then bodyS} (expression archive bodyS) - #/////synthesis.Pop + {/////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 + {.#None} (in ..fail!))] (in (.if when (_.if ..peek @@ -170,14 +170,14 @@ (in [(<=> (|> match <format>) ..peek) then!]))) - {#.Item item})] + {.#Item item})] (in (list\mix (function (_ [when then] else) (_.if when then else)) ..fail! clauses)))]) - ([#/////synthesis.I64_Fork //primitive.i64 //runtime.i64::=] - [#/////synthesis.F64_Fork //primitive.f64 _.=] - [#/////synthesis.Text_Fork //primitive.text _.=]) + ([/////synthesis.#I64_Fork //primitive.i64 //runtime.i64::=] + [/////synthesis.#F64_Fork //primitive.f64 _.=] + [/////synthesis.#Text_Fork //primitive.text _.=]) (^template [<pm> <flag> <prep>] [(^ (<pm> idx)) @@ -213,11 +213,11 @@ (in (_.try ($_ _.then ..save_cursor! leftO) - #.None - {#.Some (..catch ($_ _.then + {.#None} + {.#Some (..catch ($_ _.then ..restore_cursor! rightO))} - #.None))) + {.#None}))) ))) (def: (pattern_matching expression archive pathP) @@ -225,9 +225,9 @@ (do ///////phase.monad [pattern_matching! (pattern_matching' expression archive pathP)] (in (_.try pattern_matching! - #.None - {#.Some (..catch (_.stop (_.string "Invalid expression for pattern-matching.")))} - #.None)))) + {.#None} + {.#Some (..catch (_.stop (_.string "Invalid expression for pattern-matching.")))} + {.#None})))) (def: .public (case expression archive [valueS pathP]) (Generator [Synthesis Path]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux index 87487db01..8d049ba86 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux @@ -42,7 +42,7 @@ (def: (with_closure function_id $function inits function_definition) (-> artifact.ID SVar (List Expression) Expression (Operation Expression)) (case inits - #.End + {.#End} (do ///////phase.monad [_ (/////generation.execute! function_definition) _ (/////generation.save! (%.nat function_id) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux index 02d6712ec..d0cb917a6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux @@ -37,7 +37,7 @@ (Generator (Scope Synthesis)) (case initsS+ ... function/false/non-independent loop - #.End + {.#End} (expression archive bodyS) ... true loop 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 9d2c878cf..2c61e52f2 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 4975c0aec..54a0c637b 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 246a010c9..01d69d81b 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)) @@ -523,11 +523,11 @@ (_.try ($_ _.then (_.set! value (_.apply (list ..unit) op)) (..right value)) - #.None - {#.Some (_.function (list error) + {.#None} + {.#Some (_.function (list error) (..left (_.item (_.string "message") error)))} - #.None))) + {.#None}))) (runtime: (lux::program_args program_args) (with_vars [inputs value] 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 711366595..bafd70383 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 @@ -20,10 +20,10 @@ (def: .public (tuple expression archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ - #.End + {.#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 49389b109..2a456eba4 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 b9202972d..d2027e419 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 1e6cb7058..31fd8da27 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 @@ -56,7 +56,7 @@ ... TODO: Find some way to do 'let' without paying the price of the closure. (in (|> bodyO _.return - (_.lambda #.None (list (..register register))) + (_.lambda {.#None} (list (..register register))) (_.apply_lambda/* (list valueO)))))) (def: .public (let! statement expression archive [valueS register bodyS]) @@ -93,10 +93,10 @@ (in (list\mix (function (_ side source) (.let [method (.case side (^template [<side> <accessor>] - [(<side> lefts) + [{<side> lefts} (<accessor> (_.int (.int lefts)))]) - ([#.Left //runtime.tuple//left] - [#.Right //runtime.tuple//right]))] + ([.#Left //runtime.tuple//left] + [.#Right //runtime.tuple//right]))] (method source))) valueO (list.reversed pathP))))) @@ -188,16 +188,16 @@ (-> (-> 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 + {.#None} (in ..fail!))] - (in {#.Some (.if when + (in {.#Some (.if when (_.if ..peek then! else!) @@ -213,15 +213,15 @@ (|>> [(_.= (|> match <format>) ..peek)]) (recur then))) - {#.Item item})] - (in {#.Some (_.cond clauses + {.#Item item})] + (in {.#Some (_.cond clauses ..fail!)}))]) - ([#/////synthesis.I64_Fork (<| //primitive.i64 .int)] - [#/////synthesis.F64_Fork (<| //primitive.f64)] - [#/////synthesis.Text_Fork (<| //primitive.text)]) + ([/////synthesis.#I64_Fork (<| //primitive.i64 .int)] + [/////synthesis.#F64_Fork (<| //primitive.f64)] + [/////synthesis.#Text_Fork (<| //primitive.text)]) _ - (\ ///////phase.monad in #.None))) + (\ ///////phase.monad in {.#None}))) (def: (pattern_matching' in_closure? statement expression archive) (-> Bit (Generator! Path)) @@ -229,28 +229,28 @@ (do ///////phase.monad [?output (primitive_pattern_matching recur pathP)] (.case ?output - {#.Some output} + {.#Some output} (in output) - #.None + {.#None} (.case pathP - {#/////synthesis.Then bodyS} + {/////synthesis.#Then bodyS} (statement expression archive bodyS) - #/////synthesis.Pop + {/////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 + {.#None} (in ..fail!))] (in (.if when (_.if ..peek @@ -268,12 +268,12 @@ (|>> [(_.= (|> match <format>) ..peek)]) (recur then))) - {#.Item item})] + {.#Item item})] (in (_.cond clauses ..fail!)))]) - ([#/////synthesis.I64_Fork (<| //primitive.i64 .int)] - [#/////synthesis.F64_Fork (<| //primitive.f64)] - [#/////synthesis.Text_Fork (<| //primitive.text)]) + ([/////synthesis.#I64_Fork (<| //primitive.i64 .int)] + [/////synthesis.#F64_Fork (<| //primitive.f64)] + [/////synthesis.#Text_Fork (<| //primitive.text)]) (^template [<complex> <simple> <choice>] [(^ (<complex> idx)) @@ -353,5 +353,5 @@ (|> case (case! true statement expression archive) (\ ///////phase.monad each - (|>> (_.lambda #.None (list)) + (|>> (_.lambda {.#None} (list)) (_.apply_lambda/* (list)))))) 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 091d1fd31..b067a3319 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 @@ -45,7 +45,7 @@ (def: (with_closure inits self function_definition) (-> (List Expression) Text Expression [Statement Expression]) (case inits - #.End + {.#End} (let [@self (_.global self)] [(_.set (list @self) function_definition) @self]) @@ -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)) @@ -101,12 +101,12 @@ (_.apply_lambda/* (list output_func_args)))))]) ... (|> @num_args (_.< arityO)) (let [@missing (_.local "missing")] - (_.return (_.lambda #.None (list (_.variadic @missing)) + (_.return (_.lambda {.#None} (list (_.variadic @missing)) (_.return (|> @self (_.apply_lambda/* (list (_.splat (|> (_.array (list)) (_.do "concat" (list @curried)) (_.do "concat" (list @missing)))))))))))) )))] _ (/////generation.execute! declaration) - _ (/////generation.save! function_artifact #.None declaration)] + _ (/////generation.save! function_artifact {.#None} declaration)] (in instatiation))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux index 1aa61c2bc..b6be81745 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux @@ -52,7 +52,7 @@ (Generator! (Scope Synthesis)) (case initsS+ ... function/false/non-independent loop - #.End + {.#End} (statement expression archive bodyS) ... true loop @@ -69,7 +69,7 @@ (-> Phase! (Generator (Scope Synthesis))) (case initsS+ ... function/false/non-independent loop - #.End + {.#End} (expression archive bodyS) ... true loop @@ -77,7 +77,7 @@ (do [! ///////phase.monad] [body! (scope! statement expression archive [start initsS+ bodyS])] (in (|> body! - (_.lambda #.None (list)) + (_.lambda {.#None} (list)) (_.apply_lambda/* (list))))))) (def: .public (recur! statement expression archive argsS+) 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 643bde0b2..c10550d39 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) @@ -393,12 +393,12 @@ (Operation [Registry Output]) (do ///////phase.monad [_ (/////generation.execute! ..runtime) - _ (/////generation.save! ..module_id #.None ..runtime)] + _ (/////generation.save! ..module_id {.#None} ..runtime)] (in [(|> artifact.empty artifact.resource product.right) (row.row [..module_id - #.None + {.#None} (|> ..runtime _.code (\ utf8.codec encoded))])]))) 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 32ec74e4f..e3f1e558a 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 @@ -17,10 +17,10 @@ (def: .public (tuple generate archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ - #.End + {.#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 20108a0cd..26c13742e 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 bfdb9bf93..e2bdad616 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 @@ -69,8 +69,8 @@ (^template [<side> <accessor>] [(<side> lefts) (<accessor> (_.int (.int lefts)))]) - ([#.Left //runtime.tuple//left] - [#.Right //runtime.tuple//right]))] + ([.#Left //runtime.tuple//left] + [.#Right //runtime.tuple//right]))] (method source))) valueO (list.reversed pathP))))) @@ -122,30 +122,30 @@ (list [(_.and (list (_.string?/1 @alt_error) (_.string=?/2 ..pm_error @alt_error))) on_failure]) - #.None + {.#None} happy_path)) (def: (pattern_matching' expression archive) (Generator Path) (function (recur pathP) (.case pathP - {#/////synthesis.Then bodyS} + {/////synthesis.#Then bodyS} (expression archive bodyS) - #/////synthesis.Pop + {/////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 + {.#None} (in ..fail!))] (in (.if when (_.if ..peek @@ -164,14 +164,14 @@ (in [(<=> (|> match <format>) ..peek) then!]))) - {#.Item item})] + {.#Item item})] (in (list\mix (function (_ [when then] else) (_.if when then else)) ..fail! clauses)))]) - ([#/////synthesis.I64_Fork //primitive.i64 _.=/2] - [#/////synthesis.F64_Fork //primitive.f64 _.=/2] - [#/////synthesis.Text_Fork //primitive.text _.string=?/2]) + ([/////synthesis.#I64_Fork //primitive.i64 _.=/2] + [/////synthesis.#F64_Fork //primitive.f64 _.=/2] + [/////synthesis.#Text_Fork //primitive.text _.string=?/2]) (^template [<pm> <flag> <prep>] [(^ (<pm> idx)) 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 f0d2751f3..f45da0eaa 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 @@ -44,14 +44,14 @@ (-> (List Expression) Computation (Operation Computation)) (///////phase\in (case inits - #.End + {.#End} function_definition _ (|> function_definition (_.lambda [(|> (list.enumeration inits) (list\each (|>> product.left ..capture))) - #.None]) + {.#None}]) (_.apply/* inits))))) (def: @curried (_.var "curried")) @@ -76,13 +76,13 @@ @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])) (_.let_values (list [[(|> (list.indices arity) (list\each ..input)) - #.None] + {.#None}] (_.apply/2 (_.var "apply") (_.var "values") @curried)])) bodyO)) (_.if (|> @num_args (_.>/2 arityO)) @@ -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/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux index c5e6b5e0e..4718eca95 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux @@ -40,7 +40,7 @@ (Generator (Scope Synthesis)) (case initsS+ ... function/false/non-independent loop - #.End + {.#End} (expression archive bodyS) ... true loop @@ -52,7 +52,7 @@ (in (_.letrec (list [@scope (_.lambda [(|> initsS+ list.enumeration (list\each (|>> product.left (n.+ start) //case.register))) - #.None] + {.#None}] bodyO)]) (_.apply/* initsO+ @scope)))))) 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 0f8ae8b9a..1d15137f9 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)) @@ -102,7 +102,7 @@ (` (def: (~ (code.local_identifier (format "@" name))) _.Computation (..with_vars [(~+ inputsC)] - (_.define_function (~ runtime_name) [(list (~+ inputsC)) #.None] + (_.define_function (~ runtime_name) [(list (~+ inputsC)) {.#None}] (~ code))))))))))))) (def: last_index @@ -214,14 +214,14 @@ (runtime: (lux//try op) (with_vars [error] (_.with_exception_handler - (_.lambda [(list error) #.None] + (_.lambda [(list error) {.#None}] (..left error)) - (_.lambda [(list) #.None] + (_.lambda [(list) {.#None}] (..right (_.apply/* (list ..unit) op)))))) (runtime: (lux//program_args program_args) (with_vars [@loop @input @output] - (_.letrec (list [@loop (_.lambda [(list @input @output) #.None] + (_.letrec (list [@loop (_.lambda [(list @input @output) {.#None}] (_.if (_.null?/1 @input) @output (_.apply/2 @loop (_.cdr/1 @input) (..some (_.vector/* (list (_.car/1 @input) @output))))))]) 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 cc84cf77c..d23bf422b 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 @@ -20,10 +20,10 @@ (def: .public (tuple expression archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ - #.End + {.#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 faa6739cb..f7a4d8078 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 @@ -27,72 +27,72 @@ (def: (primitive analysis) (-> ///analysis.Primitive /.Primitive) (case analysis - #///analysis.Unit - {#/.Text /.unit} + {///analysis.#Unit} + {/.#Text /.unit} (^template [<analysis> <synthesis>] [{<analysis> value} {<synthesis> value}]) - ([#///analysis.Bit #/.Bit] - [#///analysis.Frac #/.F64] - [#///analysis.Text #/.Text]) + ([///analysis.#Bit /.#Bit] + [///analysis.#Frac /.#F64] + [///analysis.#Text /.#Text]) (^template [<analysis> <synthesis>] [{<analysis> value} {<synthesis> (.i64 value)}]) - ([#///analysis.Nat #/.I64] - [#///analysis.Int #/.I64] - [#///analysis.Rev #/.I64]))) + ([///analysis.#Nat /.#I64] + [///analysis.#Int /.#I64] + [///analysis.#Rev /.#I64]))) (def: (optimization archive) 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)))) + [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)) + (phase\each (|>> [name] {/.#Extension})) (phase.result' state)))))) ))) 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 6722a4e4e..a2cb2403a 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,19 +31,19 @@ (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 + {///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>] @@ -51,38 +51,38 @@ (///\each (function (_ then) {<to> [(<conversion> test) then] (list)}) thenC)]) - ([#///analysis.Nat #/.I64_Fork .i64] - [#///analysis.Int #/.I64_Fork .i64] - [#///analysis.Rev #/.I64_Fork .i64] - [#///analysis.Frac #/.F64_Fork |>] - [#///analysis.Text #/.Text_Fork |>])) - - {#///analysis.Bind register} - (<| (\ ///.monad each (|>> {#/.Seq {#/.Bind register}})) + ([///analysis.#Nat /.#I64_Fork .i64] + [///analysis.#Int /.#I64_Fork .i64] + [///analysis.#Rev /.#I64_Fork .i64] + [///analysis.#Frac /.#F64_Fork |>] + [///analysis.#Text /.#Text_Fork |>])) + + {///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)))) @@ -92,7 +92,7 @@ (def: (path archive synthesize pattern bodyA) (-> Archive Phase Pattern Analysis (Operation Path)) - (path' pattern true (///\each (|>> #/.Then) (synthesize archive bodyA)))) + (path' pattern true (///\each (|>> {/.#Then}) (synthesize archive bodyA)))) (def: (weave_branch weave equivalence [new_test new_then] [[old_test old_then] old_tail]) (All (_ a) (-> (-> Path Path Path) (Equivalence a) [a Path] (/.Fork a Path) @@ -101,86 +101,86 @@ [[old_test (weave new_then old_then)] old_tail] [[old_test old_then] (case old_tail - #.End + {.#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 + {/.#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] + [{/.#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 + {/.#Bit_Fork old_when (weave new_then old_then) (case [new_else old_else] - [#.None #.None] - #.None + [{.#None} {.#None}] + {.#None} - (^or [{#.Some woven_then} #.None] - [#.None {#.Some woven_then}]) - {#.Some woven_then} + (^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 + [{.#Some new_else} {.#Some old_else}] + {.#Some (weave new_else old_else)})} + {/.#Bit_Fork old_when (case new_else - #.None + {.#None} old_then - {#.Some new_else} + {.#Some new_else} (weave new_else old_then)) - {#.Some (case old_else - #.None + {.#Some (case old_else + {.#None} new_then - {#.Some old_else} + {.#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)}]) - ([#/.I64_Fork i64.equivalence] - [#/.F64_Fork frac.equivalence] - [#/.Text_Fork text.equivalence]) + ([/.#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>)]) - ([#/.Side #.Left] - [#/.Side #.Right] - [#/.Member #.Left] - [#/.Member #.Right]) + ([/.#Side .#Left] + [/.#Side .#Right] + [/.#Member .#Left] + [/.#Member .#Right]) - [{#/.Bind newR} {#/.Bind oldR}] + [{/.#Bind newR} {/.#Bind oldR}] (if (n.= newR oldR) old <default>) @@ -196,25 +196,25 @@ <continue> (as_is (recur (++ lefts) tail)) <member> (as_is (if (list.empty? tail) - {#.Right (-- lefts)} - {#.Left lefts}))] + {.#Right (-- lefts)} + {.#Left lefts}))] (case patterns - #.End + {.#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 + {.#End} <continue> sub_members @@ -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,13 +257,13 @@ (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) (-> Phase Archive Synthesis (///analysis.Tuple ///analysis.Pattern) Register (Operation Synthesis)) (case (..get patterns @member) - #.End + {.#End} (..synthesize_case synthesize archive input (!get patterns @member)) path @@ -282,8 +282,8 @@ (^ (!masking @variable @output)) (..synthesize_masking synthesize^ archive inputS @variable @output) - [[{#///analysis.Bind @variable} body] - #.End] + [[{///analysis.#Bind @variable} body] + {.#End}] (..synthesize_let synthesize^ archive inputS @variable body) (^or (^ [[(///analysis.pattern/bit #1) then] @@ -306,7 +306,7 @@ (def: .public (count_pops path) (-> Path [Nat Path]) (case path - (^ (/.path/seq #/.Pop path')) + (^ (/.path/seq {/.#Pop} path')) (let [[pops post_pops] (count_pops path')] [(++ pops) post_pops]) @@ -338,26 +338,27 @@ [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 + {.#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 +377,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 +424,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 278b6343e..09725f153 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 @@ -56,7 +56,7 @@ (with_expansions [<apply> (as_is (/.function/apply [funcS argsS]))] (case funcS (^ (/.function/abstraction functionS)) - (if (n.= (value@ #/.arity functionS) + (if (n.= (value@ /.#arity functionS) (list.size argsS)) (do ! [locals /.locals] @@ -85,17 +85,17 @@ (def: (find_foreign environment register) (-> (Environment Synthesis) Register (Operation Synthesis)) (case (list.item register environment) - {#.Some aliased} + {.#Some aliased} (phase\in aliased) - #.None + {.#None} (phase.except ..cannot_find_foreign_variable_in_environment [register environment]))) (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} @@ -103,18 +103,18 @@ [left' (grow_path grow left) right' (grow_path grow right)] (in {<tag> left' right'}))]) - ([#/.Alt] [#/.Seq]) + ([/.#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})) + {.#None} + (in {.#None}))] + (in {/.#Bit_Fork when then else})) (^template [<tag>] [{<tag> [[test then] elses]} @@ -126,14 +126,14 @@ (in [else_test else_then]))) elses)] (in {<tag> [[test then] elses]}))]) - ([#/.I64_Fork] - [#/.F64_Fork] - [#/.Text_Fork]) + ([/.#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) @@ -258,21 +258,21 @@ (|> bodyS' (grow env') (\ ! each (function (_ body) - [#/.environment environment - #/.arity (++ down_arity') - #/.body body]))) + [/.#environment environment + /.#arity (++ down_arity') + /.#body body]))) _ - (in [#/.environment environment - #/.arity 1 - #/.body bodyS])))] + (in [/.#environment environment + /.#arity 1 + /.#body bodyS])))] (in (if currying? (/.function/abstraction abstraction) (case (//loop.optimization false 1 (list) abstraction) - {#.Some [startL initsL bodyL]} - (/.function/abstraction [#/.environment environment - #/.arity (value@ #/.arity abstraction) - #/.body (/.loop/scope [startL initsL bodyL])]) + {.#Some [startL initsL bodyL]} + (/.function/abstraction [/.#environment environment + /.#arity (value@ /.#arity abstraction) + /.#body (/.loop/scope [startL initsL bodyL])]) - #.None + {.#None} (/.function/abstraction abstraction)))))) 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 c65c261e8..b994bd92e 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,8 +30,8 @@ (-> (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} @@ -39,18 +39,18 @@ [left' (recur left) right' (recur right)] (in {<tag> left' right'}))]) - ([#/.Alt] [#/.Seq]) + ([/.#Alt] [/.#Seq]) - {#/.Bit_Fork when then else} + {/.#Bit_Fork when then else} (do [! maybe.monad] [then (recur then) else (case else - {#.Some else} - (\ ! each (|>> #.Some) (recur else)) + {.#Some else} + (\ ! each (|>> {.#Some}) (recur else)) - #.None - (in #.None))] - (in {#/.Bit_Fork when then else})) + {.#None} + (in {.#None}))] + (in {/.#Bit_Fork when then else})) (^template [<tag>] [{<tag> [[test then] elses]} @@ -62,57 +62,57 @@ (in [else_test else_then]))) elses)] (in {<tag> [[test then] elses]}))]) - ([#/.I64_Fork] - [#/.F64_Fork] - [#/.Text_Fork]) + ([/.#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))] + [value' (|> variant (value@ analysis.#value) (recur false))] (in (|> variant - (with@ #analysis.value value') + (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}) + {.#None} + {.#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 @@ -141,12 +141,12 @@ (^ (/.loop/scope scope)) (do [! maybe.monad] [inits' (|> scope - (value@ #/.inits) + (value@ /.#inits) (monad.each ! (recur false))) - iteration' (recur return? (value@ #/.iteration scope))] - (in (/.loop/scope [#/.start (|> scope (value@ #/.start) (register_optimization offset)) - #/.inits inits' - #/.iteration iteration']))) + iteration' (recur return? (value@ /.#iteration scope))] + (in (/.loop/scope [/.#start (|> scope (value@ /.#start) (register_optimization offset)) + /.#inits inits' + /.#iteration iteration']))) (^ (/.loop/recur args)) (|> args @@ -165,45 +165,45 @@ [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')) (if true_loop? - #.None + {.#None} <application>)) _ <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)]})) - #.None) + (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])) - (|> (value@ #/.body functionS) - (body_optimization true_loop? offset (value@ #/.environment functionS) (value@ #/.arity functionS)) + (|> (value@ /.#body functionS) + (body_optimization true_loop? offset (value@ /.#environment functionS) (value@ /.#arity functionS)) (maybe\each (|>> [offset inits])))) 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 17399b478..75647203b 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,27 +39,27 @@ (-> (Remover Synthesis) (Remover Path)) (function (recur path) (case path - {#/.Seq {#/.Bind register} + {/.#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)}) - (^or {#/.Seq {#/.Access {#/.Member member}} - {#/.Seq {#/.Bind register} + (^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}} + {/.#Seq {/.#Seq {/.#Access {/.#Member member}} + {/.#Bind register}} post}) (if (n.= redundant register) (recur post) - {#/.Seq {#/.Access {#/.Member member}} - {#/.Seq {#/.Bind (if (n.> redundant register) + {/.#Seq {/.#Access {/.#Member member}} + {/.#Seq {/.#Bind (if (n.> redundant register) (-- register) register)} (recur post)}}) @@ -67,11 +67,11 @@ (^template [<tag>] [{<tag> left right} {<tag> (recur left) (recur right)}]) - ([#/.Seq] - [#/.Alt]) + ([/.#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]} @@ -79,93 +79,93 @@ (list\each (function (_ [test' then']) [test' (recur then')]) tail)]}]) - ([#/.I64_Fork] - [#/.F64_Fork] - [#/.Text_Fork]) + ([/.#I64_Fork] + [/.#F64_Fork] + [/.#Text_Fork]) - (^or #/.Pop - {#/.Access _}) + (^or {/.#Pop} + {/.#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) + {/.#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 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]} - {#/.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)) @@ -197,16 +197,16 @@ (All (_ a) (-> (Optimization a) (Optimization (List a)))) (function (recur [redundancy values]) (case values - #.End - {#try.Success [redundancy + {.#End} + {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]) @@ -220,20 +220,20 @@ (def: (declare register redundancy) (-> Register Redundancy (Try Redundancy)) (case (dictionary.value register redundancy) - #.None - {#try.Success (dictionary.has register ..redundant! redundancy)} + {.#None} + {try.#Success (dictionary.has register ..redundant! redundancy)} - {#.Some _} + {.#Some _} (exception.except ..redundant_declaration [register]))) (def: (observe register redundancy) (-> Register Redundancy (Try Redundancy)) (case (dictionary.value register redundancy) - #.None + {.#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) @@ -247,24 +247,24 @@ (-> (Optimization Synthesis) (Optimization Path)) (function (recur [redundancy path]) (case path - (^or #/.Pop - {#/.Access _}) - {#try.Success [redundancy + (^or {/.#Pop} + {/.#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}])) + {.#None} + (in [redundancy {.#None}]))] + (in [redundancy {/.#Bit_Fork when then else}])) (^template [<tag> <type>] [{<tag> [[test then] elses]} @@ -277,23 +277,23 @@ (in [redundancy [else_test else_then]])))) [redundancy elses])] (in [redundancy {<tag> [[test then] elses]}]))]) - ([#/.I64_Fork (I64 Any)] - [#/.F64_Fork Frac] - [#/.Text_Fork Text]) + ([/.#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 + (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 6b9fbfd09..cd3bb3f30 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/program.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/program.lux @@ -42,16 +42,16 @@ (do ! [id (archive.id module archive) [descriptor document] (archive.find module archive)] - (in [[module id] (value@ #descriptor.registry descriptor)])))))] + (in [[module id] (value@ descriptor.#registry descriptor)])))))] (case (list.one (function (_ [[module module_id] registry]) (do maybe.monad [program_id (artifact.remember ..name registry)] (in [module_id program_id]))) registries) - {#.Some program_context} + {.#Some program_context} (in program_context) - #.None + {.#None} (|> registries (list\each (|>> product.left product.left)) (exception.except ..cannot_find_program))))) 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 b855ced2f..68df640bf 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux @@ -171,11 +171,11 @@ ["Text" (%.text text)])) (template: (!failure parser where offset source_code) - [{#.Left [[where offset source_code] + [{.#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] + [{.#Left [[where offset source_code] (exception.error ..end_of_file current_module)]}]) (type: (Parser a) @@ -193,15 +193,15 @@ (template: (!letE <binding> <computation> <body>) [(case <computation> - {#.Right <binding>} + {.#Right <binding>} <body> - ... {#.Left error} + ... {.#Left error} <<otherwise>> (:expected <<otherwise>>))]) (template: (!horizontal where offset source_code) - [[(revised@ #.column ++ where) + [[(revised@ .#column ++ where) (!++ offset) source_code]]) @@ -225,62 +225,62 @@ (-> (Parser Code) Location Offset Text (Either [Source Text] [Source Code])) (loop [source (: Source [(!forward 1 where) offset source_code]) - stack (: (List Code) #.End)] + 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' + {.#Right [source' [where {<tag> (list.reversed stack)}]]} - {#.Left [source' error]}))))] + {.#Left [source' error]}))))] ... Form and tuple syntax is mostly the same, differing only in the ... delimiters involved. ... They may have an arbitrary number of arbitrary Code nodes as elements. - [form_parser ..close_form #.Form] - [variant_parser ..close_variant #.Variant] - [tuple_parser ..close_tuple #.Tuple] + [form_parser ..close_form .#Form] + [variant_parser ..close_variant .#Variant] + [tuple_parser ..close_tuple .#Tuple] ) (inline: (record_parser parse where offset source_code) (-> (Parser Code) Location Offset Text (Either [Source Text] [Source Code])) (loop [source (: Source [(!forward 1 where) offset source_code]) - stack (: (List [Code Code]) #.End)] + 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) - #.None + {.#None} body g!_ - {#.Left [[where offset source_code] + {.#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)] - (revised@ #.column (|>> (!n/+ size) (!n/+ 2)) where)) + {.#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))) @@ -295,8 +295,7 @@ [..open_form] [..close_form] [..open_variant] [..close_variant] [..open_tuple] [..close_tuple] - [..text_delimiter] - [..sigil]) + [..text_delimiter]) <digit_separator> (static ..digit_separator)] (template: (!if_digit? @char @then @else) [("lux syntax char case!" @char @@ -338,23 +337,23 @@ (!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}]]} - {#.Left error} - {#.Left [[where <start> <source_code>] + {.#Left error} + {.#Left [[where <start> <source_code>] error]})]) (def: no_exponent Offset 0) -(with_expansions [<int_output> (as_is (!number_output source_code start end int.decimal #.Int)) - <frac_output> (as_is (!number_output source_code start end frac.decimal #.Frac)) +(with_expansions [<int_output> (as_is (!number_output source_code start end int.decimal .#Int)) + <frac_output> (as_is (!number_output source_code start end frac.decimal .#Frac)) <failure> (!failure ..frac_parser where offset source_code) <frac_separator> (static ..frac_separator) <signs> (template [<sign>] @@ -412,8 +411,8 @@ [] (!number_output source_code start g!end <codec> <tag>)))))] - [nat_parser n.decimal #.Nat] - [rev_parser rev.decimal #.Rev] + [nat_parser n.decimal .#Nat] + [rev_parser rev.decimal .#Rev] ) (template: (!signed_parser source_code//size offset where source_code @aliases @end) @@ -421,9 +420,9 @@ (!with_char+ source_code//size source_code g!offset/1 g!char/1 @end) (!if_digit? g!char/1 (signed_parser source_code//size offset where (!++/2 offset) source_code) - (!full_name_parser offset [where (!++ offset) source_code] where @aliases #.Identifier)))]) + (!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)]}] @@ -440,7 +439,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 +455,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,7 +470,7 @@ (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]]})) @@ -479,7 +478,7 @@ (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 +491,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)) @@ -536,37 +535,15 @@ [(~~ (static ..text_delimiter))] (text_parser where (!++ offset/0) source_code) - ... Special code - [(~~ (static ..sigil))] - (<| (let [offset/1 (!++ offset/0)]) - (!with_char+ source_code//size source_code offset/1 char/1 - (!end_of_file where offset/1 source_code current_module)) - ("lux syntax char case!" char/1 - [[(~~ (static ..name_separator))] - (!short_name_parser source_code//size current_module <move_2> where #.Tag) - - (~~ (template [<char> <bit>] - [[<char>] - (..bit_syntax <bit> [where offset/0 source_code])] - - ["0" #0] - ["1" #1]))] - - ... else - (!if_name_char?|head char/1 - ... Tag - (!full_name_parser offset/1 <move_2> where aliases #.Tag) - (!failure ..parse where offset/0 source_code)))) - ... Coincidentally (= ..name_separator ..frac_separator) [(~~ (static ..name_separator)) ... (~~ (static ..frac_separator)) ] ... It's either a Rev, an identifier, or a comment. (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) + <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)) _ @@ -596,14 +573,29 @@ [(~~ (static ..positive_sign)) (~~ (static ..negative_sign))] (!signed_parser source_code//size offset/0 where source_code aliases - (!end_of_file where offset/0 source_code current_module))] + (!end_of_file where offset/0 source_code current_module)) + + [(~~ (static ..sigil))] + (<| (let [offset/1 (!++ offset/0)]) + (!with_char+ source_code//size source_code offset/1 char/1 + (!end_of_file where offset/1 source_code current_module)) + ("lux syntax char case!" char/1 + [(~~ (template [<char> <bit>] + [[<char>] + (..bit_syntax <bit> [where offset/0 source_code])] + + ["0" #0] + ["1" #1]))] + + ... else + (!full_name_parser offset/0 [<consume_1>] where aliases .#Identifier)))] ... else (!if_digit? char/0 ... Natural number (nat_parser source_code//size offset/0 where (!++ offset/0) source_code) ... Identifier - (!full_name_parser offset/0 [<consume_1>] where aliases #.Identifier)) + (!full_name_parser offset/0 [<consume_1>] where aliases .#Identifier)) ))) ))) )) 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 e718a2469..ad940f809 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux @@ -75,7 +75,7 @@ (type: .public (Path' s) (Variant - #Pop + {#Pop} {#Access Access} {#Bind Register} {#Bit_Fork Bit (Path' s) (Maybe (Path' s))} @@ -151,45 +151,45 @@ (def: .public path/pop Path - #Pop) + {#Pop}) (template [<name> <kind>] [(template: .public (<name> content) - [(.<| #..Access - <kind> + [(.<| {..#Access} + {<kind>} content)])] - [path/side #..Side] - [path/member #..Member] + [path/side ..#Side] + [path/member ..#Member] ) (template [<name> <kind> <side>] [(template: .public (<name> content) - [(.<| {#..Access} + [(.<| {..#Access} {<kind>} {<side>} content)])] - [side/left #..Side #.Left] - [side/right #..Side #.Right] - [member/left #..Member #.Left] - [member/right #..Member #.Right] + [side/left ..#Side .#Left] + [side/right ..#Side .#Right] + [member/left ..#Member .#Left] + [member/right ..#Member .#Right] ) (template [<name> <tag>] [(template: .public (<name> content) [{<tag> content}])] - [path/bind #..Bind] - [path/then #..Then] + [path/bind ..#Bind] + [path/then ..#Then] ) (template [<name> <tag>] [(template: .public (<name> left right) [{<tag> left right}])] - [path/alt #..Alt] - [path/seq #..Seq] + [path/alt ..#Alt] + [path/seq ..#Seq] ) (type: .public Abstraction @@ -223,27 +223,27 @@ (template [<name> <tag>] [(template: .public (<name> content) - [{#..Primitive {<tag> content}}])] + [{..#Primitive {<tag> content}}])] - [bit #..Bit] - [i64 #..I64] - [f64 #..F64] - [text #..Text] + [bit ..#Bit] + [i64 ..#I64] + [f64 ..#F64] + [text ..#Text] ) (template [<name> <tag>] [(template: .public (<name> content) - [(<| {#..Structure} + [(<| {..#Structure} {<tag>} content)])] - [variant #analysis.Variant] - [tuple #analysis.Tuple] + [variant analysis.#Variant] + [tuple analysis.#Tuple] ) (template [<name> <tag>] [(template: .public (<name> content) - [(.<| {#..Reference} + [(.<| {..#Reference} <tag> content)])] @@ -255,43 +255,43 @@ (template [<name> <family> <tag>] [(template: .public (<name> content) - [(.<| {#..Control} + [(.<| {..#Control} {<family>} {<tag>} content)])] - [branch/case #..Branch #..Case] - [branch/let #..Branch #..Let] - [branch/if #..Branch #..If] - [branch/get #..Branch #..Get] + [branch/case ..#Branch ..#Case] + [branch/let ..#Branch ..#Let] + [branch/if ..#Branch ..#If] + [branch/get ..#Branch ..#Get] - [loop/recur #..Loop #..Recur] - [loop/scope #..Loop #..Scope] + [loop/recur ..#Loop ..#Recur] + [loop/scope ..#Loop ..#Scope] - [function/abstraction #..Function #..Abstraction] - [function/apply #..Function #..Apply] + [function/abstraction ..#Function ..#Abstraction] + [function/apply ..#Function ..#Apply] ) (def: .public (%path' %then value) (All (_ a) (-> (Format a) (Format (Path' a)))) (case value - #Pop + {#Pop} "_" {#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 + {.#None} "") ")") (^template [<tag> <format>] [{<tag> item} - (|> {#.Item item} + (|> {.#Item item} (list\each (function (_ [test then]) (format (<format> test) " " (%path' %then then)))) (text.interposed " ") @@ -304,18 +304,18 @@ (case access {#Side side} (case side - {#.Left lefts} + {.#Left lefts} (format "(" (%.nat lefts) " #0" ")") - {#.Right lefts} + {.#Right lefts} (format "(" (%.nat lefts) " #1" ")")) {#Member member} (case member - {#.Left lefts} + {.#Left lefts} (format "[" (%.nat lefts) " #0" "]") - {#.Right lefts} + {.#Right lefts} (format "[" (%.nat lefts) " #1" "]"))) {#Bind register} @@ -348,12 +348,12 @@ {#Structure structure} (case structure - {#analysis.Variant [lefts right? content]} + {analysis.#Variant [lefts right? content]} (|> (%synthesis content) (format (%.nat lefts) " " (%.bit right?) " ") (text.enclosed ["{" "}"])) - {#analysis.Tuple members} + {analysis.#Tuple members} (|> members (list\each %synthesis) (text.interposed " ") @@ -393,7 +393,7 @@ {#Get members record} (|> (format (%.list (%path' %synthesis) - (list\each (|>> #Member #Access) members)) + (list\each (|>> {#Member} {#Access}) members)) " " (%synthesis record)) (text.enclosed ["{#get " "}"])) @@ -505,7 +505,7 @@ (def: (= reference sample) (case [reference sample] - [#Pop #Pop] + [{#Pop} {#Pop}] true [{#Bit_Fork reference_when reference_then reference_else} @@ -518,8 +518,8 @@ [[{<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]) @@ -551,7 +551,7 @@ (def: (hash value) (case value - #Pop + {#Pop} 2 {#Access access} @@ -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. @@ -816,7 +816,7 @@ [(template: .public (<name> idx nextP) [($_ ..path/seq (<side> idx) - #..Pop + ..#Pop nextP)])] [simple_left_side ..side/left] diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux index 0f1f5ef2c..2c5b688a2 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux @@ -90,70 +90,70 @@ (def: .public (id module archive) (-> Module Archive (Try ID)) - (let [(^slots [#..resolver]) (:representation archive)] - (case (dictionary.value module resolver) - {#.Some [id _]} - {#try.Success id} + (let [(^slots [..#resolver]) (:representation archive)] + (case (dictionary.value module #resolver) + {.#Some [id _]} + {try.#Success id} - #.None + {.#None} (exception.except ..unknown_document [module - (dictionary.keys resolver)])))) + (dictionary.keys #resolver)])))) (def: .public (reserve module archive) (-> Module Archive (Try [ID Archive])) - (let [(^slots [#..next #..resolver]) (:representation archive)] - (case (dictionary.value module resolver) - {#.Some _} + (let [(^open "_[0]") (:representation archive)] + (case (dictionary.value module _#resolver) + {.#Some _} (exception.except ..module_has_already_been_reserved [module]) - #.None - {#try.Success [next + {.#None} + {try.#Success [_#next (|> archive :representation - (revised@ #..resolver (dictionary.has module [next #.None])) - (revised@ #..next ++) + (revised@ #resolver (dictionary.has module [_#next {.#None}])) + (revised@ #next ++) :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 + (let [(^slots [..#resolver]) (:representation archive)] + (case (dictionary.value module #resolver) + {.#Some [id {.#None}]} + {try.#Success (|> archive :representation - (revised@ #..resolver (dictionary.has module [id {#.Some [descriptor document output]}])) + (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 + {.#None} (exception.except ..module_must_be_reserved_before_it_can_be_added [module])))) (def: .public (find module archive) (-> Module Archive (Try [Descriptor (Document Any) Output])) - (let [(^slots [#..resolver]) (:representation archive)] - (case (dictionary.value module resolver) - {#.Some [id {#.Some entry}]} - {#try.Success entry} + (let [(^slots [..#resolver]) (:representation archive)] + (case (dictionary.value module #resolver) + {.#Some [id {.#Some entry}]} + {try.#Success entry} - {#.Some [id #.None]} + {.#Some [id {.#None}]} (exception.except ..module_is_only_reserved [module]) - #.None + {.#None} (exception.except ..unknown_document [module - (dictionary.keys resolver)])))) + (dictionary.keys #resolver)])))) (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,17 +163,17 @@ dictionary.entries (list.all (function (_ [module [id descriptor+document]]) (case descriptor+document - {#.Some _} {#.Some module} - #.None #.None))))) + {.#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 _]} + (let [(^slots [..#resolver]) (:representation archive)] + (case (dictionary.value module #resolver) + {.#Some [id _]} bit.yes - #.None + {.#None} bit.no))) (def: .public reserved @@ -199,10 +199,10 @@ (revised@ #resolver (function (_ resolver) (list\mix (function (_ [module [id entry]] resolver) (case entry - {#.Some _} + {.#Some _} (dictionary.has module [id entry] resolver) - #.None + {.#None} resolver)) resolver (dictionary.entries +resolver)))) @@ -230,14 +230,14 @@ (def: .public (export version archive) (-> Version Archive Binary) - (let [(^slots [#..next #..resolver]) (:representation archive)] - (|> resolver + (let [(^slots [..#next ..#resolver]) (:representation archive)] + (|> #resolver dictionary.entries (list.all (function (_ [module [id descriptor+document]]) (case descriptor+document - {#.Some _} {#.Some [module id]} - #.None #.None))) - [version next] + {.#Some _} {.#Some [module id]} + {.#None} {.#None}))) + [version #next] (binary.result ..writer)))) (exception: .public (version_mismatch [expected Version @@ -280,7 +280,7 @@ (in (:abstraction [#next next #resolver (list\mix (function (_ [module id] archive) - (dictionary.has module [id #.None] archive)) + (dictionary.has module [id {.#None}] archive)) (value@ #resolver (:representation ..empty)) reservations)])))) ) 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 75753c473..9681197b8 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux @@ -26,7 +26,7 @@ (type: .public Category (Variant - #Anonymous + {#Anonymous} {#Definition Text} {#Analyser Text} {#Synthesizer Text} @@ -64,7 +64,7 @@ (|> registry :representation (revised@ #artifacts (row.suffix [#id id - #category #Anonymous])) + #category {#Anonymous}])) :abstraction)])) (template [<tag> <create> <fetch>] @@ -86,8 +86,8 @@ (value@ #artifacts) row.list (list.all (|>> (value@ #category) - (case> {<tag> name} {#.Some name} - _ #.None)))))] + (case> {<tag> name} {.#Some name} + _ {.#None})))))] [#Definition definition definitions] [#Analyser analyser analysers] @@ -109,7 +109,8 @@ (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 +136,8 @@ [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] @@ -149,7 +151,7 @@ (\ <>.monad each (row\mix (function (_ artifact registry) (product.right (case artifact - #Anonymous + {#Anonymous} (..resource registry) (^template [<tag> <create>] diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/descriptor.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/descriptor.lux index e45c69fa2..f1f68d434 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/descriptor.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/descriptor.lux @@ -44,7 +44,7 @@ <b>.text <b>.text <b>.nat - (\ <>.monad in #.Cached) + (\ <>.monad in {.#Cached}) (<b>.set text.hash <b>.text) artifact.parser )) 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 d007967f2..3207e7b8f 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux @@ -37,7 +37,7 @@ (if (\ signature.equivalence = (key.signature key) document//signature) - {#try.Success (:sharing [e] + {try.#Success (:sharing [e] (Key e) key 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 f586c398a..a7acc969b 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]} - (value@ #descriptor.references descriptor) + {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 fe1e8d223..a41580fd6 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux @@ -61,9 +61,9 @@ (def: (archive fs static) (All (_ !) (-> (file.System !) Static file.Path)) - (format (value@ #static.target static) + (format (value@ static.#target static) (\ fs separator) - (value@ #static.host static))) + (value@ static.#host static))) (def: (unversioned_lux_archive fs static) (All (_ !) (-> (file.System !) Static file.Path)) @@ -88,14 +88,14 @@ (format (..module fs static module_id) (\ fs separator) (%.nat artifact_id) - (value@ #static.artifact_extension static))) + (value@ static.#artifact_extension static))) (def: (ensure_directory fs path) (-> (file.System Async) file.Path (Async (Try Any))) (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]))))))))) @@ -125,7 +125,7 @@ (def: .public (enable fs static) (-> (file.System Async) Static (Async (Try Any))) (do (try.with async.monad) - [_ (..ensure_directory fs (value@ #static.target static))] + [_ (..ensure_directory fs (value@ static.#target static))] (..ensure_directory fs (..archive fs static)))) (def: (general_descriptor fs static) @@ -174,7 +174,7 @@ content (document.read $.key document)] (in [module content]))) (archive.archived archive)))] - (in (with@ #.modules modules (fresh_analysis_state host))))) + (in (with@ .#modules modules (fresh_analysis_state host))))) (def: (cached_artifacts fs static module_id) (-> (file.System Async) Static archive.ID (Async (Try (Dictionary Text Binary)))) @@ -223,16 +223,16 @@ 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] directive (\ host ingest context data)]] (case artifact_category - #artifact.Anonymous + {artifact.#Anonymous} (do ! - [.let [output (row.suffix [artifact_id #.None data] output)] - _ (\ host re_learn context #.None directive)] + [.let [output (row.suffix [artifact_id .#None data] output)] + _ (\ host re_learn context {.#None} directive)] (in [definitions [analysers synthesizers @@ -240,8 +240,8 @@ directives] output])) - {#artifact.Definition name} - (let [output (row.suffix [artifact_id #.None data] output)] + {artifact.#Definition name} + (let [output (row.suffix [artifact_id {.#None} data] output)] (if (text\= $/program.name name) (in [definitions [analysers @@ -250,7 +250,7 @@ directives] output]) (do ! - [value (\ host re_load context #.None directive)] + [value (\ host re_load context {.#None} directive)] (in [(dictionary.has name value definitions) [analysers synthesizers @@ -258,10 +258,10 @@ 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)] + [.let [output (row.suffix [artifact_id {.#None} data] output)] + value (\ host re_load context {.#None} directive)] (in [definitions [(dictionary.has extension (:as analysis.Handler value) analysers) synthesizers @@ -269,10 +269,10 @@ 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)] + [.let [output (row.suffix [artifact_id {.#None} data] output)] + value (\ host re_load context {.#None} directive)] (in [definitions [analysers (dictionary.has extension (:as synthesis.Handler value) synthesizers) @@ -280,10 +280,10 @@ 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)] + [.let [output (row.suffix [artifact_id {.#None} data] output)] + value (\ host re_load context {.#None} directive)] (in [definitions [analysers synthesizers @@ -291,10 +291,10 @@ 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)] + [.let [output (row.suffix [artifact_id {.#None} data] output)] + value (\ host re_load context {.#None} directive)] (in [definitions [analysers synthesizers @@ -302,50 +302,50 @@ (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]})))) + {.#End} + {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}])]) - ([#.Alias] - [#.Label] - [#.Slot]) + ([.#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]}]))))) - (value@ #.definitions content))] - (in [(document.write $.key (with@ #.definitions definitions content)) + [def_name {.#Type [exported? (:as .Type def_value) labels]}]))))) + (value@ .#definitions content))] + (in [(document.write $.key (with@ .#definitions definitions content)) bundles]))) (def: (load_definitions fs static module_id host_environment descriptor document) @@ -356,8 +356,8 @@ Bundles])))) (do (try.with async.monad) [actual (cached_artifacts fs static module_id) - .let [expected (|> descriptor (value@ #descriptor.registry) artifact.artifacts)] - [document bundles output] (async\in (loaded_document (value@ #static.artifact_extension static) host_environment module_id expected actual document))] + .let [expected (|> descriptor (value@ descriptor.#registry) artifact.artifacts)] + [document bundles output] (async\in (loaded_document (value@ static.#artifact_extension static) host_environment module_id expected actual document))] (in [[descriptor document output] bundles]))) (def: (purge! fs static [module_name module_id]) @@ -372,12 +372,12 @@ (def: (valid_cache? expected actual) (-> Descriptor Input Bit) - (and (text\= (value@ #descriptor.name expected) - (value@ #////.module actual)) - (text\= (value@ #descriptor.file expected) - (value@ #////.file actual)) - (n.= (value@ #descriptor.hash expected) - (value@ #////.hash actual)))) + (and (text\= (value@ descriptor.#name expected) + (value@ ////.#module actual)) + (text\= (value@ descriptor.#file expected) + (value@ ////.#file actual)) + (n.= (value@ descriptor.#hash expected) + (value@ ////.#hash actual)))) (type: Purge (Dictionary Module archive.ID)) @@ -387,8 +387,8 @@ Purge) (|>> (list.all (function (_ [valid_cache? [module_name [module_id _]]]) (if valid_cache? - #.None - {#.Some [module_name module_id]}))) + {.#None} + {.#Some [module_name module_id]}))) (dictionary.of_list text.hash))) (def: (full_purge caches load_order) @@ -401,7 +401,7 @@ (if (purged? module_name) purge (if (|> descriptor - (value@ #descriptor.references) + (value@ descriptor.#references) set.list (list.any? purged?)) (dictionary.has module_name module_id purge) @@ -428,7 +428,7 @@ (in [true [module_name [module_id [descriptor document]]]]) (do ! - [input (//context.read fs ..pseudo_module import contexts (value@ #static.host_module_extension static) module_name)] + [input (//context.read fs ..pseudo_module import contexts (value@ static.#host_module_extension static) module_name)] (in [(..valid_cache? descriptor input) [module_name [module_id [descriptor document]]]]))))))) load_order (|> pre_loaded_caches @@ -458,7 +458,7 @@ (archive.has module descriptor,document,output archive)) archive loaded_caches) - analysis_state (..analysis_state (value@ #static.host static) archive)] + analysis_state (..analysis_state (value@ static.#host static) archive)] (in [archive analysis_state (list\mix (function (_ [_ [+analysers +synthesizers +generators +directives]] @@ -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 - (fresh_analysis_state (value@ #static.host static)) + {try.#Failure error} + (in {try.#Success [archive.empty + (fresh_analysis_state (value@ static.#host static)) ..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 69a0858e6..59d06a9fd 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux @@ -58,15 +58,15 @@ (-> (file.System Async) Module (List Context) Module Extension (Async (Try file.Path))) (case contexts - #.End + {.#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,16 +97,16 @@ (-> 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 + {.#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 + {.#None} (exception.except ..cannot_find_module [importer module])))))) (def: (find_any_source_file fs importer import contexts partial_host_extension 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} - (in [#////.module module - #////.file path - #////.hash (text\hash code) - #////.code 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.lux b/stdlib/source/library/lux/tool/compiler/meta/packager.lux index e9224a8d0..73d919175 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager.lux @@ -35,8 +35,8 @@ (-> dependency.Order Order) (list\each (function (_ [module [module_id [descriptor document]]]) (|> descriptor - (value@ #descriptor.registry) + (value@ descriptor.#registry) artifact.artifacts row.list - (list\each (|>> (value@ #artifact.id))) + (list\each (|>> (value@ artifact.#id))) [module_id])))) 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 75eca1c30..9faeb3b47 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux @@ -143,7 +143,7 @@ (let [class_path (|> custom (maybe\each (|>> name.internal name.read)) (maybe.else (runtime.class_name [module artifact])) - (text.suffix (value@ #static.artifact_extension static)))] + (text.suffix (value@ static.#artifact_extension static)))] (do try.monad [_ (java/util/jar/JarOutputStream::putNextEntry (java/util/jar/JarEntry::new class_path) sink)] (in (do_to sink @@ -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 + {.#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 c78d07b6f..b5d364a3d 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux @@ -88,12 +88,12 @@ (def: owner tar.Owner - [#tar.name tar.anonymous - #tar.id tar.no_id]) + [tar.#name tar.anonymous + tar.#id tar.no_id]) (def: ownership - [#tar.user ..owner - #tar.group ..owner]) + [tar.#user ..owner + tar.#group ..owner]) (def: (write_module now mapping [module [module_id [descriptor document output]]]) (-> Instant (Dictionary Module archive.ID) @@ -104,7 +104,7 @@ (..bundle_module output)) entry_content (: (Try tar.Content) (|> descriptor - (value@ #descriptor.references) + (value@ descriptor.#references) set.list (list.all (function (_ module) (dictionary.value module mapping))) (list\each (|>> ..module_file _.string _.load_relative/1)) @@ -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 4809e8ed9..a54785eed 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) @@ -73,7 +73,7 @@ (def: .public failure (-> Text Operation) - (|>> #try.Failure (state.lifted try.monad))) + (|>> {try.#Failure} (state.lifted try.monad))) (def: .public (except exception parameters) (All (_ e) (-> (Exception e) e Operation)) @@ -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 0f345a12f..e61fc7b99 100644 --- a/stdlib/source/library/lux/tool/compiler/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/reference.lux @@ -48,20 +48,21 @@ (case value (^template [<factor> <tag> <hash>] [{<tag> value} - ($_ n.* <factor> - (\ <hash> hash value))]) + (|> value + (\ <hash> hash) + (n.* <factor>))]) ([2 #Variable /variable.hash] [3 #Constant name.hash]) ))) (template [<name> <family> <tag>] [(template: .public (<name> content) - [(<| <family> + [(<| {<family>} {<tag>} content)])] - [local #..Variable #/variable.Local] - [foreign #..Variable #/variable.Foreign] + [local ..#Variable /variable.#Local] + [foreign ..#Variable /variable.#Foreign] ) (template [<name> <tag>] @@ -69,8 +70,8 @@ [(<| {<tag>} content)])] - [variable #..Variable] - [constant #..Constant] + [variable ..#Variable] + [constant ..#Constant] ) (def: .public self diff --git a/stdlib/source/library/lux/tool/compiler/reference/variable.lux b/stdlib/source/library/lux/tool/compiler/reference/variable.lux index bde1de15b..e3c5ce5c2 100644 --- a/stdlib/source/library/lux/tool/compiler/reference/variable.lux +++ b/stdlib/source/library/lux/tool/compiler/reference/variable.lux @@ -44,13 +44,14 @@ (def: hash (|>> (case> (^template [<factor> <tag>] [{<tag> register} - ($_ n.* <factor> - (\ n.hash hash register))]) + (|> register + (\ n.hash hash) + (n.* <factor>))]) ([2 #Local] [3 #Foreign]))))) (template: .public (self) - [{#..Local 0}]) + [{..#Local 0}]) (def: .public self? (-> Variable Bit) diff --git a/stdlib/source/library/lux/tool/interpreter.lux b/stdlib/source/library/lux/tool/interpreter.lux index 85020815f..323aa7ff4 100644 --- a/stdlib/source/library/lux/tool/interpreter.lux +++ b/stdlib/source/library/lux/tool/interpreter.lux @@ -75,14 +75,14 @@ (do Monad<!> [state (platform.initialize platform generation_bundle) state (platform.compile platform - (with@ #cli.module syntax.prelude configuration) - (with@ [#extension.state - #directive.analysis #directive.state - #extension.state - #.info #.mode] - #.Interpreter + (with@ cli.#module syntax.prelude configuration) + (with@ [extension.#state + directive.#analysis directive.#state + extension.#state + .#info .#mode] + {.#Interpreter} state)) - [state _] (\ (value@ #platform.file_system platform) + [state _] (\ (value@ platform.#file_system platform) lift (phase.result' state enter_module)) _ (\ Console<!> write ..welcome_message)] (in state))) @@ -102,9 +102,9 @@ (-> Code <Interpretation>)) (do [! phase.monad] [state (extension.lifted phase.get_state) - .let [analyse (value@ [#directive.analysis #directive.phase] state) - synthesize (value@ [#directive.synthesis #directive.phase] state) - generate (value@ [#directive.generation #directive.phase] state)] + .let [analyse (value@ [directive.#analysis directive.#phase] state) + synthesize (value@ [directive.#synthesis directive.#phase] state) + generate (value@ [directive.#generation directive.#phase] state)] [_ codeT codeA] (directive.lifted_analysis (analysis.with_scope (type.with_fresh_env @@ -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) @@ -156,9 +156,9 @@ (do phase.monad [[codeT codeV] (interpret configuration code) state phase.get_state] - (in (/type.represent (value@ [#extension.state - #directive.analysis #directive.state - #extension.state] + (in (/type.represent (value@ [extension.#state + directive.#analysis directive.#state + extension.#state] state) codeT codeV)))) @@ -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 d01e2948b..fb91a6a2b 100644 --- a/stdlib/source/library/lux/type.lux +++ b/stdlib/source/library/lux/type.lux @@ -39,14 +39,14 @@ _ [num_args type])))] - [flat_univ_q #.UnivQ] - [flat_ex_q #.ExQ] + [flat_univ_q .#UnivQ] + [flat_ex_q .#ExQ] ) (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))]) @@ -73,14 +73,14 @@ _ (list type)))] - [flat_variant #.Sum] - [flat_tuple #.Product] + [flat_variant .#Sum] + [flat_tuple .#Product] ) (def: .public (format type) (-> Type Text) (case type - {#.Primitive name params} + {.#Primitive name params} ($_ text\composite "(primitive " (text.enclosed' text.double_quote name) @@ -98,10 +98,10 @@ (list.interposed " ") (list\mix text\composite "")) <close>)]) - ([#.Sum "(Or " ")" flat_variant] - [#.Product "[" "]" flat_tuple]) + ([.#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} ($_ text\composite "(" <desc> " {" (|> env (list\each format) (text.interposed " ")) "} " (format body) ")")]) - ([#.UnivQ "All"] - [#.ExQ "Ex"]) + ([.#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)}]) - ([#.Sum] [#.Product] - [#.Function] [#.Apply]) + ([.#Sum] [.#Product] + [.#Function] [.#Apply]) (^template [<tag>] [{<tag> old_env def} (case old_env - #.End + {.#End} {<tag> env def} _ {<tag> (list\each (reduced env) old_env) def})]) - ([#.UnivQ] - [#.ExQ]) + ([.#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))) @@ -193,24 +193,24 @@ (^template [<tag>] [[{<tag> xid} {<tag> yid}] (n.= yid xid)]) - ([#.Var] [#.Ex] [#.Parameter]) + ([.#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}] (and (= xL yL) (= xR yR))]) - ([#.Sum] [#.Product]) + ([.#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))) @@ -224,60 +224,60 @@ (def: .public (applied params func) (-> (List Type) Type (Maybe Type)) (case params - #.End - {#.Some func} + {.#End} + {.#Some func} - {#.Item param params'} + {.#Item param params'} (case func (^template [<tag>] [{<tag> env body} (|> body (reduced (list& func param env)) (applied params'))]) - ([#.UnivQ] [#.ExQ]) + ([.#UnivQ] [.#ExQ]) - {#.Apply A F} + {.#Apply A F} (applied (list& A params) F) - {#.Named name unnamed} + {.#Named name unnamed} (applied params unnamed) _ - #.None))) + {.#None}))) (def: .public (code type) (-> Type Code) (case type - {#.Primitive name params} - (` {#.Primitive (~ (code.text name)) + {.#Primitive name params} + (` {.#Primitive (~ (code.text name)) (.list (~+ (list\each code params)))}) (^template [<tag>] [{<tag> idx} (` {<tag> (~ (code.nat idx))})]) - ([#.Var] [#.Ex] [#.Parameter]) + ([.#Var] [.#Ex] [.#Parameter]) (^template [<tag>] [{<tag> left right} (` {<tag> (~ (code left)) (~ (code right))})]) - ([#.Sum] [#.Product] [#.Function] [#.Apply]) + ([.#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))})]) - ([#.UnivQ] [#.ExQ]) + ([.#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') _ @@ -295,36 +295,36 @@ [(def: .public (<name> types) (-> (List Type) Type) (case types - #.End + {.#End} <base> - {#.Item type #.End} + {.#Item type {.#End}} type - {#.Item type types'} + {.#Item type types'} {<ctor> type (<name> types')}))] - [variant Nothing #.Sum] - [tuple Any #.Product] + [variant Nothing .#Sum] + [tuple Any .#Product] ) (def: .public (function inputs output) (-> (List Type) Type Type) (case inputs - #.End + {.#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) (case params - #.End + {.#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) @@ -333,22 +333,22 @@ 0 body _ (|> body (<name> (-- size)) {<tag> (list)})))] - [univ_q #.UnivQ] - [ex_q #.ExQ] + [univ_q .#UnivQ] + [ex_q .#ExQ] ) (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,16 +399,16 @@ ($_ text\composite (name\encoded (name_of ..:log!)) " " (location.format location) text.new_line "Expression: " (case valueC - {#.Some valueC} + {.#Some valueC} (code.format valueC) - #.None + {.#None} (name\encoded valueN)) text.new_line " 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))))))))) @@ -426,10 +426,10 @@ (-> (~ input) (~ output))) (|>> :expected)))] (case value - #.None + {.#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 51216b293..9ce2ce24d 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)))) @@ -43,36 +43,36 @@ (def: frames (Stack Frame) - #.End) + {.#End}) (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)) - #.End + {.#End} (undefined)))]) (def: (peek_frames_definition reference source) (-> 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) (-> Text Text (List [Text Module]) (Stack Frame)) (!peek source reference - (peek_frames_definition definition_reference (value@ #.definitions head)))) + (peek_frames_definition definition_reference (value@ .#definitions head)))) (exception: .public no_active_frames) @@ -80,66 +80,66 @@ (-> (Maybe Text) (Meta Frame)) (function (_ compiler) (let [[reference definition_reference] (name_of ..frames) - current_frames (peek_frames reference definition_reference (value@ #.modules compiler))] + 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 + {.#None} (..peek current_frames)) - {#.Some frame} - {#.Right [compiler frame]} + {.#Some frame} + {.#Right [compiler frame]} - #.None + {.#None} (exception.except ..no_active_frames []))))) (def: .public current (Meta Frame) - (..peek! #.None)) + (..peek! {.#None})) (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>] + {.#Item [head_name <then>] tail} - {#.Item [head_name head] + {.#Item [head_name head] (recur tail)}) - #.End + {.#End} (undefined)))]) (def: (push_frame_definition reference frame source) (-> 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))]} - (^or {#.Type _} - {#.Alias _} - {#.Label _} - {#.Slot _}) + (^or {.#Type _} + {.#Alias _} + {.#Label _} + {.#Slot _}) (undefined)))) (def: (push_frame [module_reference definition_reference] frame source) (-> Name Frame (List [Text Module]) (List [Text Module])) (!push source module_reference - (revised@ #.definitions (push_frame_definition definition_reference frame) head))) + (revised@ .#definitions (push_frame_definition definition_reference frame) head))) (def: (push! frame) (-> Frame (Meta Any)) (function (_ compiler) - {#.Right [(revised@ #.modules + {.#Right [(revised@ .#modules (..push_frame (name_of ..frames) frame) compiler) []]})) @@ -148,31 +148,31 @@ (-> 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 + {.#None} current_frames))]} - (^or {#.Type _} - {#.Alias _} - {#.Label _} - {#.Slot _}) + (^or {.#Type _} + {.#Alias _} + {.#Label _} + {.#Slot _}) (undefined)))) (def: (pop_frame [module_reference definition_reference] source) (-> Name (List [Text Module]) (List [Text Module])) (!push source module_reference - (|> head (revised@ #.definitions (pop_frame_definition definition_reference))))) + (|> head (revised@ .#definitions (pop_frame_definition definition_reference))))) (syntax: (pop! []) (function (_ compiler) - {#.Right [(revised@ #.modules + {.#Right [(revised@ .#modules (..pop_frame (name_of ..frames)) compiler) (list)]})) @@ -180,7 +180,7 @@ (def: cast (Parser [(Maybe Text) Code]) (<>.either (<>.and (<>.maybe <code>.local_identifier) <code>.any) - (<>.and (<>\in #.None) <code>.any))) + (<>.and (<>\in {.#None}) <code>.any))) (template [<name> <from> <to>] [(syntax: .public (<name> [[frame value] ..cast]) @@ -200,7 +200,7 @@ (def: representation_definition_name (-> Text Text) (|>> ($_ text\composite - (name\encoded (name_of #..Representation)) + (name\encoded (name_of ..#Representation)) " "))) (def: declaration diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux index b0ea2a745..2fd8affb1 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,54 +132,54 @@ (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] + {.#Item [var_id var_type] plist'} (if (!n\= id var_id) - {#.Some var_type} + {.#Some var_type} (var::get id plist')) - #.End - #.None)) + {.#End} + {.#None})) (def: (var::put id value plist) (-> Var (Maybe Type) Type_Vars Type_Vars) (case plist - #.End + {.#End} (list [id value]) - {#.Item [var_id var_type] + {.#Item [var_id var_type] plist'} (if (!n\= id var_id) - {#.Item [var_id value] + {.#Item [var_id value] plist'} - {#.Item [var_id var_type] + {.#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))) @@ -188,27 +188,27 @@ (def: .public existential (Check [Nat Type]) (function (_ context) - (let [id (value@ #.ex_counter context)] - {#try.Success [(revised@ #.ex_counter ++ context) - [id {#.Ex id}]]}))) + (let [id (value@ .#ex_counter context)] + {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>]} + (case (|> context (value@ .#var_bindings) (var::get id)) + (^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 + {.#None} (exception.except ..unknown_type_var id))))] - [bound? Bit false true] - [peek (Maybe Type) #.None {#.Some bound}] + [bound? Bit false true] + [peek (Maybe Type) {.#None} {.#Some bound}] ) (def: .public (read id) @@ -216,20 +216,20 @@ (do ..monad [?type (peek id)] (case ?type - {#.Some type} + {.#Some type} (in type) - #.None + {.#None} (..except ..unbound_type_var id)))) (def: (bound id) (-> Var (Check Type)) (function (_ context) - (case (|> context (value@ #.var_bindings) (var::get id)) - {#.Some {#.Some bound}} - {#try.Success [context bound]} + (case (|> context (value@ .#var_bindings) (var::get id)) + {.#Some {.#Some bound}} + {try.#Success [context bound]} - {#.Some _} + {.#Some _} (exception.except ..unbound_type_var id) _ @@ -238,12 +238,12 @@ (def: .public (bind type id) (-> 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) + (case (|> context (value@ .#var_bindings) (var::get id)) + {.#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]) _ @@ -252,9 +252,9 @@ (def: (re_bind type id) (-> 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) + (case (|> context (value@ .#var_bindings) (var::get id)) + {.#Some _} + {try.#Success [(revised@ .#var_bindings (var::put id {.#Some type}) context) []]} _ @@ -263,33 +263,33 @@ (def: .public var (Check [Var Type]) (function (_ context) - (let [id (value@ #.var_counter context)] - {#try.Success [(|> context - (revised@ #.var_counter ++) - (revised@ #.var_bindings (var::new id))) - [id {#.Var id}]]}))) + (let [id (value@ .#var_counter context)] + {try.#Success [(|> context + (revised@ .#var_counter ++) + (revised@ .#var_bindings (var::new 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) _ @@ -308,44 +308,44 @@ (function (_ context) (loop [current start output (set.has start empty_ring)] - (case (|> context (value@ #.var_bindings) (var::get current)) - {#.Some {#.Some type}} + (case (|> context (value@ .#var_bindings) (var::get current)) + {.#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 + {.#None} (exception.except ..unknown_type_var current))))) (def: .public fresh_context Type_Context - [#.var_counter 0 - #.ex_counter 0 - #.var_bindings (list)]) + [.#var_counter 0 + .#ex_counter 0 + .#var_bindings (list)]) (def: (attempt op) (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) @@ -400,36 +400,36 @@ abound (attempt (..bound idA))] (case [ebound abound] ... Link the 2 variables circularly - [#.None #.None] + [{.#None} {.#None}] (do ! [_ (link/2 idE idA)] (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,38 +563,38 @@ (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')) @@ -606,8 +606,8 @@ [[_ paramT] <instancer> expected' (..on paramT expected)] (check' assumptions expected' actual))]) - ([#.UnivQ ..existential] - [#.ExQ ..var]) + ([.#UnivQ ..existential] + [.#ExQ ..var]) ... TODO: Refactor-away as cold-code (^template [<tag> <instancer>] @@ -616,19 +616,19 @@ [[_ paramT] <instancer> actual' (..on paramT actual)] (check' assumptions expected actual'))]) - ([#.UnivQ ..var] - [#.ExQ ..existential]) + ([.#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 a_params a_params] (case [e_params a_params] - [#.End #.End] + [{.#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)) @@ -642,23 +642,23 @@ (do ..monad [assumptions (check' assumptions eL aL)] (check' assumptions eR aR))]) - ([#.Sum] - [#.Product]) + ([.#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,26 +672,26 @@ (-> 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>] @@ -700,13 +700,13 @@ [leftT' (clean leftT)] (|> (clean rightT) (check\each (|>> {<tag> leftT'}))))]) - ([#.Sum] [#.Product] [#.Function] [#.Apply]) + ([.#Sum] [.#Product] [.#Function] [.#Apply]) - {#.Var id} + {.#Var id} (do ..monad [?actualT (peek id)] (case ?actualT - {#.Some actualT} + {.#Some actualT} (clean actualT) _ @@ -717,5 +717,5 @@ (do [! ..monad] [envT+' (monad.each ! clean envT+)] (in {<tag> envT+' unquantifiedT}))]) - ([#.UnivQ] [#.ExQ]) + ([.#UnivQ] [.#ExQ]) )) diff --git a/stdlib/source/library/lux/type/dynamic.lux b/stdlib/source/library/lux/type/dynamic.lux index 412f811ec..48fb68378 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 03379a14e..1d32fd57c 100644 --- a/stdlib/source/library/lux/type/implicit.lux +++ b/stdlib/source/library/lux/type/implicit.lux @@ -29,19 +29,19 @@ (def: (type_var id env) (-> Nat Type_Context (Meta Type)) (case (list.example (|>> product.left (n.= id)) - (value@ #.var_bindings env)) - {#.Some [_ {#.Some type}]} + (value@ .#var_bindings env)) + {.#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 + {.#None} (meta.failure (format "Unknown type-var " (%.nat id))) )) @@ -51,8 +51,8 @@ [raw_type (meta.type var_name) compiler meta.compiler_state] (case raw_type - {#.Var id} - (type_var id (value@ #.type_context compiler)) + {.#Var id} + (type_var id (value@ .#type_context compiler)) _ (in raw_type)))) @@ -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 + {.#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)) @@ -97,10 +97,10 @@ candidates (list.only (|>> product.right (text\= simple_name)) tag_lists)]] (case candidates - #.End + {.#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,15 +157,15 @@ dictionary.entries (list.all (function (_ [name type]) (if (compatible_type? sig_type type) - {#.Some [["" name] type]} - #.None))))))) + {.#Some [["" name] type]} + {.#None}))))))) (def: (local_structs sig_type) (-> Type (Meta (List [Name Type]))) (do [! meta.monad] [this_module_name meta.current_module_name definitions (meta.definitions this_module_name)] - (in (available_definitions sig_type this_module_name this_module_name definitions #.End)))) + (in (available_definitions sig_type this_module_name this_module_name definitions {.#End})))) (def: (imported_structs sig_type) (-> Type (Meta (List [Name Type]))) @@ -175,16 +175,16 @@ accessible_definitions (monad.each ! meta.definitions imported_modules)] (in (list\mix (function (_ [imported_module definitions] tail) (available_definitions sig_type imported_module this_module_name definitions tail)) - #.End + {.#End} (list.zipped/2 imported_modules accessible_definitions))))) (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,13 +241,13 @@ 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 + {.#End} (meta.failure (format "No candidates for provisioning: " (%.type dep))) found @@ -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 + {.#End} (check.failure (format "No candidates for provisioning: " (%.type dep))) - {#.Item winner #.End} + {.#Item winner {.#End}} (\ check.monad in winner) _ @@ -292,13 +292,13 @@ 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 + {.#End} (meta.failure (format "No alternatives for " (%.type (type.function input_types output_type)))) found @@ -315,7 +315,7 @@ (def: (var? input) (-> Code Bit) (case input - [_ {#.Identifier _}] + [_ {.#Identifier _}] #1 _ @@ -328,7 +328,7 @@ (def: (instance$ [constructor dependencies]) (-> Instance Code) (case dependencies - #.End + {.#End} (code.identifier constructor) _ @@ -338,17 +338,17 @@ 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) output_type meta.expected_type chosen_ones (alternatives sig_type member_idx input_types output_type)] (case chosen_ones - #.End + {.#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 1656e88ca..705c72ecc 100644 --- a/stdlib/source/library/lux/type/poly.lux +++ b/stdlib/source/library/lux/type/poly.lux @@ -42,32 +42,32 @@ (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)) + {.#Primitive name params} + (` {.#Primitive (~ (code.text name)) (.list (~+ (list\each (code env) params)))}) (^template [<tag>] [{<tag> idx} (` {<tag> (~ (code.nat idx))})]) - ([#.Var] [#.Ex]) + ([.#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)) @@ -76,20 +76,20 @@ [{<tag> left right} (` {<tag> (~ (code env left)) (~ (code env right))})]) - ([#.Function] [#.Apply]) + ([.#Function] [.#Apply]) (^template [<macro> <tag> <flattener>] [{<tag> left right} (` (<macro> (~+ (list\each (code env) (<flattener> type)))))]) - ([.Union #.Sum type.flat_variant] - [.Tuple #.Product type.flat_tuple]) + ([.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))})]) - ([#.UnivQ] [#.ExQ]) + ([.#UnivQ] [.#ExQ]) ))) diff --git a/stdlib/source/library/lux/type/refinement.lux b/stdlib/source/library/lux/type/refinement.lux index 2de171779..8e4f23952 100644 --- a/stdlib/source/library/lux/type/refinement.lux +++ b/stdlib/source/library/lux/type/refinement.lux @@ -25,9 +25,9 @@ (-> (Predicate t) (Refiner t %)))) (function (_ value) (if (predicate value) - {#.Some (:abstraction [#value value + {.#Some (:abstraction [#value value #predicate predicate])} - #.None))) + {.#None}))) (template [<name> <output> <slot>] [(def: .public <name> @@ -44,45 +44,45 @@ (-> (Refined t %) (Maybe (Refined t %))))) (function (_ refined) (let [(^slots [#value #predicate]) (:representation refined) - value' (transform value)] - (if (predicate value') - {#.Some (:abstraction [#value value' - #predicate predicate])} - #.None)))) + value' (transform #value)] + (if (#predicate value') + {.#Some (:abstraction [..#value value' + ..#predicate #predicate])} + {.#None})))) ) (def: .public (only refiner values) (All (_ t %) (-> (Refiner t %) (List t) (List (Refined t %)))) (case values - #.End - #.End + {.#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 + {.#None} (only refiner tail)))) (def: .public (partition refiner values) (All (_ t %) (-> (Refiner t %) (List t) [(List (Refined t %)) (List t)])) (case values - #.End - [#.End #.End] + {.#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 + {.#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 5c2618263..23d504446 100644 --- a/stdlib/source/library/lux/type/resource.lux +++ b/stdlib/source/library/lux/type/resource.lux @@ -129,10 +129,10 @@ (syntax: .public (exchange [swaps ..indices]) (macro.with_identifiers [g!_ g!context g!!] (case swaps - #.End + {.#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/type/unit.lux b/stdlib/source/library/lux/type/unit.lux index 7b60ba1f5..4a47eaf50 100644 --- a/stdlib/source/library/lux/type/unit.lux +++ b/stdlib/source/library/lux/type/unit.lux @@ -29,11 +29,11 @@ (abstract: .public (Qty unit) Int - (def: in + (def: in' (All (_ unit) (-> Int (Qty unit))) (|>> :abstraction)) - (def: out + (def: out' (All (_ unit) (-> (Qty unit) Int)) (|>> :representation)) @@ -79,11 +79,11 @@ (def: .public pure (-> Int Pure) - ..in) + ..in') (def: .public number (-> Pure Int) - ..out) + ..out') (syntax: .public (unit: [[export_policy type_name unit_name] (|export|.parser @@ -99,11 +99,11 @@ (` (implementation: (~ export_policy) (~ (code.local_identifier unit_name)) (..Unit (~ g!type)) - (def: (~' in) (~! ..in)) - (def: (~' out) (~! ..out)))) + (def: (~' in) (~! ..in')) + (def: (~' out) (~! ..out')))) )))) -(def: scale +(def: scaleP (Parser Ratio) (<code>.tuple (do <>.monad [numerator <code>.nat @@ -119,9 +119,9 @@ ($_ <>.and <code>.local_identifier <code>.local_identifier - ..scale))]) + ..scaleP))]) (do meta.monad - [.let [(^slots [#ratio.numerator #ratio.denominator]) ratio] + [.let [(^slots [ratio.#numerator ratio.#denominator]) ratio] @ meta.current_module_name .let [g!scale (code.local_identifier type_name)]] (in (list (` (type: (~ export_policy) ((~ g!scale) (~' u)) @@ -131,17 +131,17 @@ (..Scale (~ g!scale)) (def: (~' scale) - (|>> ((~! ..out)) - (i.* (~ (code.int (.int numerator)))) - (i./ (~ (code.int (.int denominator)))) - ((~! ..in)))) + (|>> ((~! ..out')) + (i.* (~ (code.int (.int #numerator)))) + (i./ (~ (code.int (.int #denominator)))) + ((~! ..in')))) (def: (~' de_scale) - (|>> ((~! ..out)) - (i.* (~ (code.int (.int denominator)))) - (i./ (~ (code.int (.int numerator)))) - ((~! ..in)))) + (|>> ((~! ..out')) + (i.* (~ (code.int (.int #denominator)))) + (i./ (~ (code.int (.int #numerator)))) + ((~! ..in')))) (def: (~' ratio) - [(~ (code.nat numerator)) (~ (code.nat denominator))]))) + [(~ (code.nat #numerator)) (~ (code.nat #denominator))]))) )))) (def: .public (re_scaled from to quantity) @@ -149,10 +149,10 @@ (let [[numerator denominator] (ratio./ (\ from ratio) (\ to ratio))] (|> quantity - out + out' (i.* (.int numerator)) (i./ (.int denominator)) - in))) + in'))) (syntax: (implementation_name [type_name <code>.local_identifier]) (in (list (code.local_identifier (text.lower_cased type_name))))) @@ -185,7 +185,7 @@ (All (_ unit) (Equivalence (Qty unit))) (def: (= reference sample) - (i.= (..out reference) (..out sample)))) + (i.= (..out' reference) (..out' sample)))) (implementation: .public order (All (_ unit) (Order (Qty unit))) @@ -193,11 +193,11 @@ (def: &equivalence ..equivalence) (def: (< reference sample) - (i.< (..out reference) (..out sample)))) + (i.< (..out' reference) (..out' sample)))) (implementation: .public enum (All (_ unit) (Enum (Qty unit))) (def: &order ..order) - (def: succ (|>> ..out ++ ..in)) - (def: pred (|>> ..out -- ..in))) + (def: succ (|>> ..out' ++ ..in')) + (def: pred (|>> ..out' -- ..in'))) diff --git a/stdlib/source/library/lux/world/console.lux b/stdlib/source/library/lux/world/console.lux index 7c974630f..276fd51de 100644 --- a/stdlib/source/library/lux/world/console.lux +++ b/stdlib/source/library/lux/world/console.lux @@ -71,14 +71,14 @@ (do io.monad [?jvm_console (java/lang/System::console)] (case ?jvm_console - #.None + {.#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 - #try.Success + {try.#Success} (: (Console IO)) ... TODO: Remove ASAP (implementation (def: (read _) @@ -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 aa8a168af..117edaab3 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 3772ff0e1..0ec397faf 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,11 +142,11 @@ (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) + {try.#Success value} + {try.#Success [(++ idx) (instant.from_millis (java/util/Date::getTime value))]})))] [date java/sql/ResultSet::getDate] @@ -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/db/sql.lux b/stdlib/source/library/lux/world/db/sql.lux index 60abb4484..dd0a2dd7e 100644 --- a/stdlib/source/library/lux/world/db/sql.lux +++ b/stdlib/source/library/lux/world/db/sql.lux @@ -214,7 +214,7 @@ (format <op> " " (case columns - #.End + {.#End} "*" _ @@ -292,7 +292,7 @@ (Query where having No_Order group limit offset) (Query where having With_Order group limit offset))) (case pairs - #.End + {.#End} (|> query :representation :abstraction) _ @@ -310,7 +310,7 @@ (Query where having order No_Group limit offset) (Query where having order With_Group limit offset))) (case pairs - #.End + {.#End} (|> query :representation :abstraction) _ @@ -335,7 +335,7 @@ (-> Table (List [Column Value]) (Command No_Where No_Having)) (:abstraction (format "UPDATE " (:representation table) (case pairs - #.End + {.#End} "" _ diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux index 82796463c..5a8c23c48 100644 --- a/stdlib/source/library/lux/world/file.lux +++ b/stdlib/source/library/lux/world/file.lux @@ -81,10 +81,10 @@ (All (_ !) (-> (System !) Path (Maybe [Path Text]))) (let [/ (\ fs separator)] (case (text.last_index / path) - #.None - #.None + {.#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,14 +230,14 @@ (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) + (array.list {.#None}) (monad.only ! (|>> <method>)) (\ ! each (monad.each ! (|>> java/io/File::getAbsolutePath))) (\ ! conjoint)) - #.None + {.#None} (\ io.monad in (exception.except ..cannot_find_directory [path])))))] [directory_files java/io/File::isFile] @@ -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))))) @@ -451,7 +451,7 @@ subs (with_async write! (Try (Array ffi.String)) (Fs::readdir [path (..value_callback write!)] node_fs))] (|> subs - (array.list #.None) + (array.list {.#None}) (list\each (|>> (format path ..js_separator))) (monad.each ! (function (_ sub) (\ ! each (|>> (<method> []) [sub]) @@ -487,12 +487,12 @@ (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) + {try.#Success}) (with_async write! (Try Any) (Fs::access [path (|> node_fs Fs::constants FsConstants::X_OK) @@ -598,7 +598,7 @@ (let [! (try.with io.monad)] (|> path os::listdir - (\ ! each (|>> (array.list #.None) + (\ ! each (|>> (array.list {.#None}) (list\each (|>> (format path ..python_separator))) (monad.each ! (function (_ sub) (\ ! each (|>> [sub]) (<method> [sub])))) @@ -725,19 +725,19 @@ [self (RubyDir::open [path]) children (RubyDir::children [] self) output (loop [input (|> children - (array.list #.None) + (array.list {.#None}) (list\each (|>> (format path ..ruby_separator)))) output (: (List ..Path) (list))] (case input - #.End + {.#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)))] @@ -918,21 +918,21 @@ ... (do [! (try.with io.monad)] ... [children (..scandir [path])] ... (loop [input (|> children - ... (array.list #.None) + ... (array.list {.#None}) ... (list.only (function (_ child) ... (not (or (text\= "." child) ... (text\= ".." child)))))) ... output (: (List (<capability> IO)) ... (list))] ... (case input - ... #.End + ... {.#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,23 +1013,23 @@ (loop [directory mock trail (text.all_split_by separator path)] (case trail - {#.Item head tail} + {.#Item head tail} (case (dictionary.value head directory) - #.None + {.#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) _ (exception.except ..cannot_find_file [path]))) - #.End + {.#End} (exception.except ..cannot_find_file [path])))) (def: (update_mock_file! / path now content mock) @@ -1037,38 +1037,38 @@ (loop [directory mock trail (text.all_split_by / path)] (case trail - {#.Item head tail} + {.#Item head tail} (case (dictionary.value head directory) - #.None + {.#None} (case tail - #.End - {#try.Success (dictionary.has head - {#.Left [#mock_last_modified now + {.#End} + {try.#Success (dictionary.has head + {.#Left [#mock_last_modified now #mock_can_execute false #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)} - [{#.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]))) - #.End + {.#End} (exception.except ..cannot_find_file [path])))) (def: (delete_mock_node! / path mock) @@ -1076,34 +1076,34 @@ (loop [directory mock trail (text.all_split_by / path)] (case trail - {#.Item head tail} + {.#Item head tail} (case (dictionary.value head directory) - #.None + {.#None} (exception.except ..cannot_delete [path]) - {#.Some node} + {.#Some node} (case tail - #.End + {.#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 + {.#End} (exception.except ..cannot_delete [path])))) (def: (attempt! transform var) @@ -1111,40 +1111,40 @@ (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 + {.#None} (case tail - #.End - {#try.Success (dictionary.has head {#.Right ..empty_mock} directory)} + {.#End} + {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]))) - #.End + {.#End} (exception.except ..cannot_make_directory [path])))) (def: (retrieve_mock_directory! / path mock) @@ -1152,25 +1152,25 @@ (loop [directory mock trail (text.all_split_by / path)] (case trail - #.End - {#try.Success directory} + {.#End} + {try.#Success directory} - {#.Item head tail} + {.#Item head tail} (case (dictionary.value head directory) - #.None + {.#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} + {.#End} + {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) @@ -1218,13 +1218,13 @@ (list.all (function (_ [node_name node]) (case node {<tag> _} - {#.Some (format path separator node_name)} + {.#Some (format path separator node_name)} _ - #.None))))))))))] + {.#None}))))))))))] - [directory_files #.Left] - [sub_directories #.Right] + [directory_files .#Left] + [sub_directories .#Right] )) (def: (file_size path) @@ -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) @@ -1328,10 +1328,10 @@ (case (if rooted? (list.after 1 segments) segments) - #.End + {.#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 []}) + {.#End} + (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 51ac92a90..86620bd7b 100644 --- a/stdlib/source/library/lux/world/file/watch.lux +++ b/stdlib/source/library/lux/world/file/watch.lux @@ -112,12 +112,12 @@ (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)) - #.None + {.#None} (in false)))) (def: (file_tracker fs directory) @@ -143,7 +143,7 @@ (\ ! each (|>> [file])))) files))) -(def: (available_directory_changes fs [directory [concern file_tracker]]) +(def: (available_directory_changes fs [directory [the_concern file_tracker]]) (-> (//.System Async) [//.Path [Concern File_Tracker]] (Async (Try [[//.Path [Concern File_Tracker]] [(List [//.Path Instant]) @@ -151,14 +151,14 @@ (List //.Path)]]))) (do [! (try.with async.monad)] [current_files (..available_files fs directory) - .let [creations (if (..creation? concern) + .let [creations (if (..creation? the_concern) (list.only (|>> product.left (dictionary.key? file_tracker) not) current_files) (list)) available (|> current_files (list\each product.left) (set.of_list text.hash)) - deletions (if (..deletion? concern) + deletions (if (..deletion? the_concern) (|> (dictionary.entries file_tracker) (list\each product.left) (list.only (|>> (set.member? available) not))) @@ -169,7 +169,7 @@ (in [path previous_modification current_modification]))) current_files)]] (in [[directory - [concern + [the_concern (let [with_deletions (list\mix dictionary.lacks file_tracker deletions) with_creations (list\mix (function (_ [path last_modified] tracker) (dictionary.has path last_modified tracker)) @@ -196,34 +196,34 @@ (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 [it file_tracker]} + {try.#Success it} - #.None + {.#None} (exception.except ..not_being_watched [path])))))) (def: (stop path) (stm.commit! (do [! stm.monad] [@tracker (stm.read tracker)] (case (dictionary.value path @tracker) - {#.Some [concern file_tracker]} + {.#Some [the_concern file_tracker]} (do ! [_ (stm.update (dictionary.lacks path) tracker)] - (in {#try.Success concern})) + (in {try.#Success the_concern})) - #.None + {.#None} (in (exception.except ..not_being_watched [path])))))) (def: (poll _) (do async.monad @@ -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]) @@ -275,10 +275,10 @@ (All (_ a) (-> (java/util/List a) (List a))) (let [size (.nat (java/util/List::size list))] (loop [idx 0 - output #.End] + output {.#End}] (if (n.< size idx) (recur (++ idx) - {#.Item (java/util/List::get (.int idx) list) + {.#Item (java/util/List::get (.int idx) list) output}) output)))) @@ -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? @@ -385,12 +385,12 @@ (:as java/nio/file/Path) java/nio/file/Path::toString (:as //.Path))] - concern (..default_key_concern key)] - (recur {#.Item [concern path] + the_concern (..default_key_concern key)] + (recur {.#Item [the_concern path] output})) (recur output))) - #.None + {.#None} (in output))))) (def: (watch_events concern) @@ -420,36 +420,36 @@ (do [! async.monad] [@tracker (stm.commit! (stm.read tracker))] (case (dictionary.value path @tracker) - {#.Some [concern key]} + {.#Some [the_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 the_concern})) - #.None + {.#None} (in (exception.except ..not_being_watched [path]))))))]] (in (: (Watcher Async) (implementation - (def: (start concern path) + (def: (start the_concern path) (do async.monad [?concern (stop path)] (do (try.with async.monad) [key (..default_start (..watch_events (..also (try.else ..none ?concern) - concern)) + the_concern)) watcher path)] (do async.monad - [_ (stm.commit! (stm.update (dictionary.has path [concern key]) tracker))] - (in {#try.Success []}))))) + [_ (stm.commit! (stm.update (dictionary.has path [the_concern key]) tracker))] + (in {try.#Success []}))))) (def: (concern path) (do async.monad [@tracker (stm.commit! (stm.read tracker))] (case (dictionary.value path @tracker) - {#.Some [concern key]} - (in {#try.Success concern}) + {.#Some [it key]} + (in {try.#Success it}) - #.None + {.#None} (in (exception.except ..not_being_watched [path]))))) (def: stop stop) (def: (poll _) diff --git a/stdlib/source/library/lux/world/net/http.lux b/stdlib/source/library/lux/world/net/http.lux index 8afbd105b..8e61f33a0 100644 --- a/stdlib/source/library/lux/world/net/http.lux +++ b/stdlib/source/library/lux/world/net/http.lux @@ -17,15 +17,15 @@ (type: .public Method (Variant - #Post - #Get - #Put - #Patch - #Delete - #Head - #Connect - #Options - #Trace)) + {#Post} + {#Get} + {#Put} + {#Patch} + {#Delete} + {#Head} + {#Connect} + {#Options} + {#Trace})) (type: .public Port Nat) @@ -48,8 +48,8 @@ (type: .public Scheme (Variant - #HTTP - #HTTPS)) + {#HTTP} + {#HTTPS})) (type: .public Address (Record diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux index 472c49a52..7fed7739e 100644 --- a/stdlib/source/library/lux/world/net/http/client.lux +++ b/stdlib/source/library/lux/world/net/http/client.lux @@ -36,8 +36,8 @@ (! (Try (//.Response !)))) request))) -(syntax: (method_function [[_ name] <code>.tag]) - (in (list (code.local_identifier (text.lower_cased name))))) +(syntax: (method_function [[_ name] <code>.identifier]) + (in (list (code.local_identifier (text.replaced "#" "" (text.lower_cased name)))))) (template [<method>] [(with_expansions [<name> (method_function <method>)] @@ -45,17 +45,17 @@ (All (_ !) (-> URL //.Headers (Maybe Binary) (Client !) (! (Try (//.Response !))))) - (\ client request <method> url headers data)))] - - [#//.Post] - [#//.Get] - [#//.Put] - [#//.Patch] - [#//.Delete] - [#//.Head] - [#//.Connect] - [#//.Options] - [#//.Trace] + (\ client request {<method>} url headers data)))] + + [//.#Post] + [//.#Get] + [//.#Put] + [//.#Patch] + [//.#Delete] + [//.#Head] + [//.#Connect] + [//.#Options] + [//.#Trace] ) (def: default_buffer_size @@ -108,15 +108,15 @@ (def: jvm_method (-> //.Method Text) - (|>> (case> #//.Post "POST" - #//.Get "GET" - #//.Put "PUT" - #//.Patch "PATCH" - #//.Delete "DELETE" - #//.Head "HEAD" - #//.Connect "CONNECT" - #//.Options "OPTIONS" - #//.Trace "TRACE"))) + (|>> (case> {//.#Post} "POST" + {//.#Get} "GET" + {//.#Put} "PUT" + {//.#Patch} "PATCH" + {//.#Delete} "DELETE" + {//.#Head} "HEAD" + {//.#Connect} "CONNECT" + {//.#Options} "OPTIONS" + {//.#Trace} "TRACE"))) (def: (default_body input) (-> java/io/BufferedInputStream (//.Body IO)) @@ -172,13 +172,13 @@ (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) (dictionary.has name (maybe.else "" ?value) headers))) - #.None + {.#None} (in headers))))) (implementation: .public default @@ -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) @@ -203,7 +203,7 @@ _ (java/lang/AutoCloseable::close stream)] (in [])) - #.None + {.#None} (in [])) status (java/net/HttpURLConnection::getResponseCode connection) headers (..default_headers connection) @@ -211,8 +211,8 @@ java/net/URLConnection::getInputStream (\ ! each (|>> java/io/BufferedInputStream::new)))] (in [(.nat status) - [#//.headers headers - #//.body (..default_body input)]]))))))] + [//.#headers headers + //.#body (..default_body input)]]))))))] (for [@.old (as_is <jvm>) @.jvm (as_is <jvm>)] (as_is))) @@ -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)]} - {#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/cookie.lux b/stdlib/source/library/lux/world/net/http/cookie.lux index b1a829f9a..a7e2d1644 100644 --- a/stdlib/source/library/lux/world/net/http/cookie.lux +++ b/stdlib/source/library/lux/world/net/http/cookie.lux @@ -59,14 +59,14 @@ (type: .public CSRF_Policy (Variant - #Strict - #Lax)) + {#Strict} + {#Lax})) (def: .public (same_site policy) (-> CSRF_Policy Directive) (..directive (format "SameSite=" (case policy - #Strict "Strict" - #Lax "Lax")))) + {#Strict} "Strict" + {#Lax} "Lax")))) (def: (cookie context) (-> Context (Parser Context)) diff --git a/stdlib/source/library/lux/world/net/http/request.lux b/stdlib/source/library/lux/world/net/http/request.lux index c6185bc09..12287083d 100644 --- a/stdlib/source/library/lux/world/net/http/request.lux +++ b/stdlib/source/library/lux/world/net/http/request.lux @@ -56,73 +56,73 @@ (All (_ a) (-> (<json>.Reader a) (-> a Server) Server)) (function (_ (^@ request [identification protocol resource message])) (do async.monad - [?raw (read_text_body (value@ #//.body message))] + [?raw (read_text_body (value@ //.#body message))] (case (do try.monad [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) (-> (-> Text Server) Server) (function (_ (^@ request [identification protocol resource message])) (do async.monad - [?raw (read_text_body (value@ #//.body message))] + [?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) (All (_ a) (-> (Property a) (-> a Server) Server)) (function (_ [identification protocol resource message]) - (let [full (value@ #//.uri resource) + (let [full (value@ //.#uri resource) [uri query] (|> full (text.split_by "?") (maybe.else [full ""]))] (case (do try.monad [query (//query.parameters query) input (context.result query property)] - (in [[identification protocol (with@ #//.uri uri resource) message] + (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) (All (_ a) (-> (Property a) (-> a Server) Server)) (function (_ (^@ request [identification protocol resource message])) (do async.monad - [?body (read_text_body (value@ #//.body message))] + [?body (read_text_body (value@ //.#body message))] (case (do try.monad [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) (All (_ a) (-> (Property a) (-> a Server) Server)) (function (_ (^@ request [identification protocol resource message])) (case (do try.monad - [cookies (|> (value@ #//.headers message) + [cookies (|> (value@ //.#headers message) (dictionary.value "Cookie") (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/net/http/response.lux b/stdlib/source/library/lux/world/net/http/response.lux index 0a03f9f31..272e906b5 100644 --- a/stdlib/source/library/lux/world/net/http/response.lux +++ b/stdlib/source/library/lux/world/net/http/response.lux @@ -32,15 +32,15 @@ (let [body (frp\in (\ encoding.utf8 encoded ""))] (function (_ status) [status - [#//.headers (|> context.empty + [//.#headers (|> context.empty (header.content_length 0) (header.content_type mime.utf_8)) - #//.body body]]))) + //.#body body]]))) (def: .public (temporary_redirect to) (-> URL Response) (let [[status message] (..empty status.temporary_redirect)] - [status (revised@ #//.headers (header.location to) message)])) + [status (revised@ //.#headers (header.location to) message)])) (def: .public not_found Response @@ -49,10 +49,10 @@ (def: .public (content status type data) (-> Status MIME Binary Response) [status - [#//.headers (|> context.empty + [//.#headers (|> context.empty (header.content_length (binary.size data)) (header.content_type type)) - #//.body (frp\in data)]]) + //.#body (frp\in data)]]) (def: .public bad_request (-> Text Response) diff --git a/stdlib/source/library/lux/world/net/http/route.lux b/stdlib/source/library/lux/world/net/http/route.lux index 4232f4481..92b522254 100644 --- a/stdlib/source/library/lux/world/net/http/route.lux +++ b/stdlib/source/library/lux/world/net/http/route.lux @@ -18,46 +18,46 @@ [(def: .public (<name> server) (-> Server Server) (function (_ (^@ request [identification protocol resource message])) - (case (value@ #//.scheme protocol) - <scheme> + (case (value@ //.#scheme protocol) + {<scheme>} (server request) _ (async.resolved //response.not_found))))] - [#//.HTTP http] - [#//.HTTPS https] + [//.#HTTP http] + [//.#HTTPS https] ) (template [<method> <name>] [(def: .public (<name> server) (-> Server Server) (function (_ (^@ request [identification protocol resource message])) - (case (value@ #//.method resource) - <method> + (case (value@ //.#method resource) + {<method>} (server request) _ (async.resolved //response.not_found))))] - [#//.Get get] - [#//.Post post] - [#//.Put put] - [#//.Patch patch] - [#//.Delete delete] - [#//.Head head] - [#//.Connect connect] - [#//.Options options] - [#//.Trace trace] + [//.#Get get] + [//.#Post post] + [//.#Put put] + [//.#Patch patch] + [//.#Delete delete] + [//.#Head head] + [//.#Connect connect] + [//.#Options options] + [//.#Trace trace] ) (def: .public (uri path server) (-> URI Server Server) (function (_ [identification protocol resource message]) - (if (text.starts_with? path (value@ #//.uri resource)) + (if (text.starts_with? path (value@ //.#uri resource)) (server [identification protocol - (revised@ #//.uri + (revised@ //.#uri (|>> (text.clip_since (text.size path)) maybe.trusted) resource) message]) diff --git a/stdlib/source/library/lux/world/program.lux b/stdlib/source/library/lux/world/program.lux index 5d5604777..3a4b1417a 100644 --- a/stdlib/source/library/lux/world/program.lux +++ b/stdlib/source/library/lux/world/program.lux @@ -62,11 +62,11 @@ (in (|> entries (list.all (function (_ [name value]) (case value - {#try.Success value} - {#.Some [name value]} + {try.#Success value} + {.#Some [name value]} - {#try.Failure _} - #.None))) + {try.#Failure _} + {.#None}))) (dictionary.of_list text.hash))))) (`` (implementation: .public (async program) @@ -97,10 +97,10 @@ (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 + {.#None} (exception.except ..unknown_environment_variable [name])))) (def: home home) @@ -137,9 +137,9 @@ (def: (jvm\\consume iterator) (All (_ a) (-> (java/util/Iterator a) (List a))) (if (java/util/Iterator::hasNext iterator) - {#.Item (java/util/Iterator::next iterator) + {.#Item (java/util/Iterator::next iterator) (jvm\\consume iterator)} - #.End)) + {.#End})) )] (for [@.old (as_is <jvm>) @.jvm (as_is <jvm>) @@ -155,10 +155,10 @@ (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 + {.#None} (..default_exit! code))) (import: Browser_Window @@ -173,23 +173,23 @@ (-> 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)) - [#.None #.None] + [{.#None} {.#None}] (..default_exit! code))) (import: Object @@ -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,18 +247,18 @@ (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)] (in (maybe.else default ?output))) - #.None + {.#None} (in default)) - {#try.Failure _} + {try.#Failure _} (in default))))) @.ruby (as_is (ffi.import: Env "as" RubyEnv ["[1]::[0]" @@ -314,25 +314,25 @@ @.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) + (array.list {.#None}) (list\each (|>> (array.read! 0) maybe.trusted))) - #.None + {.#None} (list)) (list))) - @.python (\ io.monad each (array.list #.None) (os/environ::keys [])) + @.python (\ io.monad each (array.list {.#None}) (os/environ::keys [])) ... Lua offers no way to get all the environment variables available. @.lua (io.io (list)) @.ruby (|> (RubyEnv::keys []) - (array.list #.None) + (array.list {.#None}) io.io) ... @.php (do io.monad ... [environment (..getenv/0 [])] ... (in (|> environment ... ..array_keys - ... (array.list #.None) + ... (array.list {.#None}) ... (list\each (function (_ variable) ... [variable ("php array read" (:as Nat variable) environment)])) ... (dictionary.of_list text.hash)))) @@ -352,10 +352,10 @@ [(do io.monad [value (<method> name)] (in (case value - {#.Some value} - {#try.Success value} + {.#Some value} + {try.#Success value} - #.None + {.#None} (exception.except ..unknown_environment_variable [name]))))]] (with_expansions [<jvm> (!fetch java/lang/System::resolveEnv)] (for [@.old <jvm> @@ -365,10 +365,10 @@ [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 + {.#None} (exception.except ..unknown_environment_variable [name])) (exception.except ..unknown_environment_variable [name]))) @.python (!fetch os/environ::get) @@ -407,10 +407,10 @@ @.jvm <jvm> @.js (if ffi.on_node_js? (case (ffi.constant ..NodeJs_Process [process]) - {#.Some process} + {.#Some process} (NodeJs_Process::cwd [] process) - #.None + {.#None} (io.io <default>)) (io.io <default>)) @.python (os::getcwd []) diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux index 3fd76261b..29ff3ab2e 100644 --- a/stdlib/source/library/lux/world/shell.lux +++ b/stdlib/source/library/lux/world/shell.lux @@ -50,7 +50,7 @@ (: (-> [] (! (Try Text))) read) (: (-> [] (! (Try Text))) - error) + fail) (: (-> Text (! (Try Any))) write) (: (-> [] (! (Try Any))) @@ -67,7 +67,7 @@ async.future))] [read] - [error] + [fail] [write] [destroy] [await] @@ -140,11 +140,11 @@ (Ex (_ ?) (-> (Sanitizer Command) (Sanitizer Argument) (Policy ?))) (?.with_policy (: (Context Safety Policy) - (function (_ (^open "?\[0]")) + (function (_ (^open "?[0]")) (implementation - (def: command (|>> safe_command ?\can_upgrade)) - (def: argument (|>> safe_argument ?\can_upgrade)) - (def: value ?\can_downgrade)))))) + (def: command (|>> safe_command ?#can_upgrade)) + (def: argument (|>> safe_argument ?#can_upgrade)) + (def: value ?#can_downgrade)))))) (def: unix_policy (let [replacer (: Replacer @@ -249,14 +249,14 @@ (do ! [output (java/io/BufferedReader::readLine <stream>)] (case output - {#.Some output} + {.#Some output} (in output) - #.None + {.#None} (\ io.monad in (exception.except ..no_more_output [])))))] [read jvm_input] - [error jvm_error] + [fail jvm_error] )) (def: (write message) (java/io/OutputStream::write (\ utf8.codec encoded message) jvm_output)) @@ -315,7 +315,7 @@ (: (-> s (Try [s Text])) on_read) (: (-> s (Try [s Text])) - on_error) + on_fail) (: (-> Text s (Try s)) on_write) (: (-> s (Try s)) @@ -331,40 +331,40 @@ (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] + [fail on_fail] [await on_await] )) (def: (write message) (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 80d8e37e7..53bdcd06c 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 @@ -82,19 +82,19 @@ (All (_ a) (-> (-> a JSON) (-> (Maybe a) JSON))) (function (_ elem) (case elem - #.None #/.Null - {#.Some value} (writer value)))) + {.#None} {/.#Null} + {.#Some value} (writer value)))) (implementation: qty_codec (All (_ unit) (codec.Codec JSON (unit.Qty unit))) (def: encoded - (|>> ((debug.private unit.out)) + (|>> ((debug.private unit.out')) (\ ..int_codec encoded))) (def: decoded (|>> (\ ..int_codec decoded) - (\ try.functor each (debug.private unit.in))))) + (\ try.functor each (debug.private unit.in'))))) (poly: encoded (with_expansions @@ -105,17 +105,17 @@ (in (` (: (~ (@JSON\encoded inputT)) <encoder>))))] - [(<type>.exactly Any) (function ((~ g!_) (~ (code.identifier ["" "0"]))) #/.Null)] - [(<type>.sub Bit) (|>> {#/.Boolean})] + [(<type>.exactly Any) (function ((~ g!_) (~ (code.identifier ["" "0"]))) {/.#Null})] + [(<type>.sub Bit) (|>> {/.#Boolean})] [(<type>.sub Nat) (\ (~! ..nat_codec) (~' encoded))] [(<type>.sub Int) (\ (~! ..int_codec) (~' encoded))] - [(<type>.sub Frac) (|>> {#/.Number})] - [(<type>.sub Text) (|>> {#/.String})]) + [(<type>.sub Frac) (|>> {/.#Number})] + [(<type>.sub Text) (|>> {/.#String})]) <time> (template [<type> <codec>] [(do ! [_ (<type>.exactly <type>)] (in (` (: (~ (@JSON\encoded inputT)) - (|>> (\ (~! <codec>) (~' encoded)) {#/.String})))))] + (|>> (\ (~! <codec>) (~' encoded)) {/.#String})))))] ... [duration.Duration duration.codec] ... [instant.Instant instant.codec] @@ -150,7 +150,7 @@ ((~! list\each) (function ((~ g!_) [(~ g!key) (~ g!val)]) [(~ g!key) ((~ =val=) (~ g!val))])) ((~! dictionary.of_list) (~! text.hash)) - {#/.Object}))))) + {/.#Object}))))) (do ! [[_ =sub=] (<type>.applied ($_ <>.and (<type>.exactly .Maybe) @@ -162,7 +162,7 @@ (<type>.exactly .List) encoded))] (in (` (: (~ (@JSON\encoded inputT)) - (|>> ((~! list\each) (~ =sub=)) ((~! row.of_list)) {#/.Array}))))) + (|>> ((~! list\each) (~ =sub=)) ((~! row.of_list)) {/.#Array}))))) (do ! [.let [g!_ (code.local_identifier "_______") g!input (code.local_identifier "_______input")] diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux index 758397321..6bc8f1f90 100644 --- a/stdlib/source/program/aedifex.lux +++ b/stdlib/source/program/aedifex.lux @@ -66,9 +66,9 @@ (def: repositories (-> /.Profile (List (Repository Async))) - (|>> (value@ #/.repositories) + (|>> (value@ /.#repositories) set.list - (list\each (|>> (/repository/remote.repository http.default #.None) /repository.async)))) + (list\each (|>> (/repository/remote.repository http.default {.#None}) /repository.async)))) (def: (with_dependencies program console command profile) (All (_ a) @@ -79,7 +79,7 @@ [resolution (/command/deps.do! console (/repository/local.repository program (file.async file.default)) (..repositories profile) - (|>> (/repository/remote.repository http.default #.None) + (|>> (/repository/remote.repository http.default {.#None}) /repository.async) profile) [exit_code output] ((command console program (file.async file.default) (shell.async shell.default) resolution) profile) @@ -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,12 +128,12 @@ (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 + {/cli.#Version} (..command (/command/version.do! console (\ /.monoid identity))) @@ -141,72 +141,72 @@ (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 + {/cli.#Version} (in []) - #/cli.Clean + {/cli.#Clean} (..command (/command/clean.do! console (file.async file.default) profile)) - #/cli.POM + {/cli.#POM} (..command (/command/pom.do! console (file.async file.default) profile)) - #/cli.Install + {/cli.#Install} (..command (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} - (case (dictionary.value repository (value@ #/.deploy_repositories profile)) - {#.Some repository} + (case (value@ /.#identity profile) + {.#Some artifact} + (case (dictionary.value repository (value@ /.#deploy_repositories profile)) + {.#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) - #.None - (async\in (exception.except ..cannot_find_repository [repository (value@ #/.deploy_repositories profile)]))) + {.#None} + (async\in (exception.except ..cannot_find_repository [repository (value@ /.#deploy_repositories profile)]))) - #.None + {.#None} (async\in (exception.except /.no_identity [])))) - #/cli.Dependencies + {/cli.#Dependencies} (..command (/command/deps.do! console (/repository/local.repository program (file.async file.default)) (..repositories profile) - (|>> (/repository/remote.repository http.default #.None) + (|>> (/repository/remote.repository http.default {.#None}) /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.#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) - #/cli.Test (..with_dependencies program console (/command/auto.do! /command/auto.delay watcher /command/test.do!) profile))))))) + {/cli.#Build} (..with_dependencies program console (/command/auto.do! /command/auto.delay watcher /command/build.do!) profile) + {/cli.#Test} (..with_dependencies program console (/command/auto.do! /command/auto.delay watcher /command/test.do!) profile))))))) )))))) diff --git a/stdlib/source/program/aedifex/artifact/snapshot.lux b/stdlib/source/program/aedifex/artifact/snapshot.lux index 5ac1e126a..16e10286e 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot.lux @@ -17,7 +17,7 @@ (type: .public Snapshot (Variant - #Local + {#Local} {#Remote Stamp})) (implementation: any_equivalence @@ -45,9 +45,9 @@ (def: local_copy_format XML - {#xml.Node <local_copy> + {xml.#Node <local_copy> xml.attributes - (list {#xml.Text ..local_copy_value})}) + (list {xml.#Text ..local_copy_value})}) (def: local_copy_parser (Parser Any) @@ -57,9 +57,9 @@ (def: .public (format snapshot) (-> Snapshot XML) - (<| {#xml.Node ..<snapshot> xml.attributes} + (<| {xml.#Node ..<snapshot> xml.attributes} (case snapshot - #Local + {#Local} (list ..local_copy_format) {#Remote stamp} diff --git a/stdlib/source/program/aedifex/artifact/snapshot/build.lux b/stdlib/source/program/aedifex/artifact/snapshot/build.lux index 4960f5862..44adcc18b 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/build.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/build.lux @@ -31,9 +31,9 @@ (def: .public format (-> Build XML) (|>> %.nat - #xml.Text + {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 a840bd3c0..f5a08e942 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 2dac99df9..194956419 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 5f1816b3e..12fe26c46 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux @@ -32,11 +32,11 @@ (def: .public (format (^slots [#version #snapshot])) (%.Format Value) (case snapshot - #///.Local + {///.#Local} version - {#///.Remote stamp} - (let [(^slots [#///stamp.time #///stamp.build]) stamp] + {///.#Remote stamp} + (let [(^slots [///stamp.#time ///stamp.#build]) stamp] (%.format (text.replaced ..snapshot (///time.format time) version) diff --git a/stdlib/source/program/aedifex/artifact/time/date.lux b/stdlib/source/program/aedifex/artifact/time/date.lux index 167d0d2a2..3eeda23f0 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/time/time.lux b/stdlib/source/program/aedifex/artifact/time/time.lux index c27b1b69c..8b3258c3a 100644 --- a/stdlib/source/program/aedifex/artifact/time/time.lux +++ b/stdlib/source/program/aedifex/artifact/time/time.lux @@ -21,10 +21,10 @@ (def: .public (format value) (%.Format Time) - (let [(^slots [#time.hour #time.minute #time.second]) (time.clock value)] - (%.format (//.pad hour) - (//.pad minute) - (//.pad second)))) + (let [(^slots [time.#hour time.#minute time.#second]) (time.clock value)] + (%.format (//.pad #hour) + (//.pad #minute) + (//.pad #second)))) (def: .public parser (<text>.Parser Time) @@ -33,7 +33,7 @@ minute (<>.codec n.decimal (<text>.exactly 2 <text>.decimal)) second (<>.codec n.decimal (<text>.exactly 2 <text>.decimal))] (<>.lifted (time.time - [#time.hour hour - #time.minute minute - #time.second second - #time.milli_second 0])))) + [time.#hour hour + time.#minute minute + time.#second second + time.#milli_second 0])))) diff --git a/stdlib/source/program/aedifex/artifact/versioning.lux b/stdlib/source/program/aedifex/artifact/versioning.lux index cf30987d2..dbac91543 100644 --- a/stdlib/source/program/aedifex/artifact/versioning.lux +++ b/stdlib/source/program/aedifex/artifact/versioning.lux @@ -36,7 +36,7 @@ #versions (List Version)])) (def: .public init - [#snapshot #//snapshot.Local + [#snapshot {//snapshot.#Local} #last_updated //time.epoch #versions (list)]) @@ -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)) @@ -84,7 +84,7 @@ (Parser Versioning) (<| (<xml>.node ..<versioning>) ($_ <>.and - (<>.else #//snapshot.Local (<xml>.somewhere //snapshot.parser)) + (<>.else {//snapshot.#Local} (<xml>.somewhere //snapshot.parser)) (<>.else //time.epoch (<xml>.somewhere ..last_updated_parser)) (<| (<>.else (list)) <xml>.somewhere diff --git a/stdlib/source/program/aedifex/cli.lux b/stdlib/source/program/aedifex/cli.lux index fc4cf5440..bf02c76cd 100644 --- a/stdlib/source/program/aedifex/cli.lux +++ b/stdlib/source/program/aedifex/cli.lux @@ -18,8 +18,8 @@ (type: .public Compilation (Variant - #Build - #Test)) + {#Build} + {#Test})) (implementation: any_equivalence (Equivalence Any) @@ -39,11 +39,11 @@ (type: .public Command (Variant - #Version - #Clean - #POM - #Dependencies - #Install + {#Version} + {#Clean} + {#POM} + {#Dependencies} + {#Install} {#Deploy Text Identity} {#Compilation Compilation} {#Auto Compilation})) @@ -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 0b82f4d81..2160398eb 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) @@ -53,7 +53,7 @@ (with_expansions [<call> ((command console program fs shell resolution) profile)] (do [! async.monad] [targets (|> profile - (value@ #///.sources) + (value@ ///.#sources) set.list (monad.each ! (..targets fs)) (\ ! each list.together))] @@ -65,10 +65,10 @@ [_ (..pause delay) events (\ watcher poll [])] (case events - {#.Item _} + {.#Item _} (do ! [_ <call>] (recur [])) - #.End + {.#End} (recur [])))))))))) diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 63d2affb7..c16f7c9ef 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -49,10 +49,10 @@ (-> Group Name Finder) (|>> dictionary.entries (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} - #.None))))) + (if (and (text\= group (value@ [///dependency.#artifact ///artifact.#group] dependency)) + (text\= name (value@ [///dependency.#artifact ///artifact.#name] dependency))) + {.#Some dependency} + {.#None}))))) (def: .public lux_group Group @@ -91,11 +91,11 @@ (-> 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) + {try.#Success [(..remove_dependency dependency resolution) {<tag> dependency}]}]) ([#JVM ..jvm_compiler_name] [#JS ..js_compiler_name] @@ -112,17 +112,17 @@ (def: (path fs home dependency) (All (_ !) (-> (file.System !) Path Dependency Path)) (let [/ (\ fs separator) - artifact (value@ #///dependency.artifact dependency)] + artifact (value@ ///dependency.#artifact dependency)] (|> artifact - (///local.uri (value@ #///artifact.version artifact)) + (///local.uri (value@ ///artifact.#version artifact)) (text.replaced uri.separator /) (format home /) - (text.suffix (format "." (value@ #///dependency.type dependency)))))) + (text.suffix (format "." (value@ ///dependency.#type dependency)))))) (def: (libraries fs home) (All (_ !) (-> (file.System !) Path Resolution (List Path))) (|>> dictionary.keys - (list.only (|>> (value@ #///dependency.type) + (list.only (|>> (value@ ///dependency.#type) (text\= ///artifact/type.lux_library))) (list\each (..path fs home)))) @@ -139,39 +139,39 @@ (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] + [{.#End} {.#End}] false)))) (def: .public (host_dependencies fs home) (All (_ !) (-> (file.System !) Path Resolution (List Path))) (|>> dictionary.keys - (list.only (|>> (value@ #///dependency.type) + (list.only (|>> (value@ ///dependency.#type) (text\= ///artifact/type.lux_library) not)) (list\mix (function (_ dependency uniques) - (let [artifact (value@ #///dependency.artifact dependency) - identity [(value@ #///artifact.group artifact) - (value@ #///artifact.name artifact)] - version (value@ #///artifact.version artifact)] + (let [artifact (value@ ///dependency.#artifact dependency) + identity [(value@ ///artifact.#group artifact) + (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) - #.None + {.#None} (dictionary.has identity [version dependency] uniques)))) (: (Dictionary [Group Name] [Version Dependency]) (dictionary.empty (product.hash text.hash text.hash)))) @@ -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,41 +245,41 @@ (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) (-> (List Path) ///runtime.Runtime ///runtime.Runtime) (case host_dependencies - #.End + {.#End} runtime _ - (revised@ #///runtime.parameters + (revised@ ///runtime.#parameters (|>> (list& "-cp" (..jvm_class_path host_dependencies))) runtime))) (def: .public (do! console program fs shell resolution) (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Compiler Path])) (function (_ profile) - (let [target (value@ #///.target profile)] - (case (value@ #///.program profile) - #.None + (let [target (value@ ///.#target profile)] + (case (value@ ///.#program profile) + {.#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) working_directory (\ program directory)]] (do ///action.monad - [[resolution compiler] (async\in (..compiler resolution (value@ #///.compiler profile))) + [[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} - [(|> (value@ #///.java profile) - (with@ #///runtime.parameters (list "program._")) - (with_jvm_class_path {#.Item (..path fs home dependency) host_dependencies})) + [(|> (value@ ///.#java profile) + (with@ ///runtime.#parameters (list "program._")) + (with_jvm_class_path {.#Item (..path fs home dependency) host_dependencies})) "program.jar"] (^template [<tag> <runtime> <program>] @@ -288,10 +288,10 @@ (..path fs home) (///runtime.for (value@ <runtime> profile))) <program>]]) - ([#JS #///.js "program.js"] - [#Python #///.java "program.py"] - [#Lua #///.java "program.lua"] - [#Ruby #///.java "program.rb"])) + ([#JS ///.#js "program.js"] + [#Python ///.#java "program.py"] + [#Lua ///.#java "program.lua"] + [#Ruby ///.#java "program.rb"])) / (\ fs separator) cache_directory (format working_directory / target)] _ (console.write_line ..start console) @@ -299,7 +299,7 @@ (list "build") (..plural "--library" (..libraries fs home resolution)) (..plural "--host_dependency" host_dependencies) - (..plural "--source" (set.list (value@ #///.sources profile))) + (..plural "--source" (set.list (value@ ///.#sources profile))) (..singular "--target" cache_directory) (..singular "--module" program_module)))] process (\ shell execute [environment diff --git a/stdlib/source/program/aedifex/command/clean.lux b/stdlib/source/program/aedifex/command/clean.lux index 232bde793..d175ae291 100644 --- a/stdlib/source/program/aedifex/command/clean.lux +++ b/stdlib/source/program/aedifex/command/clean.lux @@ -33,7 +33,7 @@ (def: .public (do! console fs profile) (-> (Console Async) (file.System Async) (Command Any)) (do [! async.monad] - [.let [target (value@ #///.target profile)] + [.let [target (value@ ///.#target profile)] ? (\ fs directory? target) _ (let [! ///action.monad] (if ? diff --git a/stdlib/source/program/aedifex/command/deploy.lux b/stdlib/source/program/aedifex/command/deploy.lux index 4d18f1b18..7210e9a30 100644 --- a/stdlib/source/program/aedifex/command/deploy.lux +++ b/stdlib/source/program/aedifex/command/deploy.lux @@ -60,7 +60,7 @@ (-> (Console Async) (Repository Async) (file.System Async) Artifact (Command Any)) (do [! ///action.monad] [library (|> profile - (value@ #/.sources) + (value@ /.#sources) set.list (export.library fs) (\ ! each (binary.result tar.writer))) @@ -71,10 +71,10 @@ (let [pom_data (|> pom (\ xml.codec encoded) (\ utf8.codec encoded))] - [#///package.origin {#///repository/origin.Remote ""} - #///package.library [library + [///package.#origin {///repository/origin.#Remote ""} + ///package.#library [library (///dependency/status.verified library)] - #///package.pom [pom + ///package.#pom [pom pom_data (///dependency/status.verified pom_data)]]))] (console.write_line ..success console))) diff --git a/stdlib/source/program/aedifex/command/deps.lux b/stdlib/source/program/aedifex/command/deps.lux index f26a76211..ed636efeb 100644 --- a/stdlib/source/program/aedifex/command/deps.lux +++ b/stdlib/source/program/aedifex/command/deps.lux @@ -33,16 +33,16 @@ (def: format (%.Format Dependency) - (|>> (value@ #///dependency.artifact) + (|>> (value@ ///dependency.#artifact) ///artifact.format %.text)) (def: .public (do! console local remotes new_repository profile) (-> (Console Async) (Repository Async) (List (Repository Async)) (-> URL (Repository Async)) (Command Resolution)) (do async.monad - [.let [dependencies (|> (value@ #///.dependencies profile) + [.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 65575f63f..4b413faa5 100644 --- a/stdlib/source/program/aedifex/command/install.lux +++ b/stdlib/source/program/aedifex/command/install.lux @@ -51,11 +51,11 @@ (def: .public (do! console fs repository profile) (-> (Console Async) (file.System Async) (Repository Async) (Command Any)) - (case (value@ #/.identity profile) - {#.Some identity} + (case (value@ /.#identity profile) + {.#Some identity} (do ///action.monad [package (|> profile - (value@ #/.sources) + (value@ /.#sources) set.list (export.library fs)) pom (|> profile @@ -66,10 +66,10 @@ (let [pom_data (|> pom (\ xml.codec encoded) (\ utf8.codec encoded))] - [#///package.origin {#///origin.Local ""} - #///package.library (let [library (binary.result tar.writer package)] + [///package.#origin {///origin.#Local ""} + ///package.#library (let [library (binary.result tar.writer package)] [library (///dependency/status.verified library)]) - #///package.pom [pom + ///package.#pom [pom pom_data (///dependency/status.verified pom_data)]]))] (console.write_line ..success console)) diff --git a/stdlib/source/program/aedifex/command/test.lux b/stdlib/source/program/aedifex/command/test.lux index 3e5cad3c6..04f4e8e27 100644 --- a/stdlib/source/program/aedifex/command/test.lux +++ b/stdlib/source/program/aedifex/command/test.lux @@ -36,25 +36,25 @@ (do [! ///action.monad] [.let [home (\ program home)] [build_exit compiler program] (//build.do! console program fs shell resolution - (with@ #///.program (value@ #///.test profile) profile))] + (with@ ///.#program (value@ ///.#test profile) profile))] (if (i.= shell.normal build_exit) (do ! [_ (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)) + (///runtime.for (value@ ///.#java profile)) (//build.with_jvm_class_path host_dependencies)) (^template [<tag> <runtime>] [{<tag> artifact} (///runtime.for (value@ <runtime> profile) program)]) - ([#//build.JS #///.js] - [#//build.Python #///.python] - [#//build.Lua #///.lua] - [#//build.Ruby #///.ruby]))] + ([//build.#JS ///.#js] + [//build.#Python ///.#python] + [//build.#Lua ///.#lua] + [//build.#Ruby ///.#ruby]))] process (\ shell execute [environment working_directory test_command diff --git a/stdlib/source/program/aedifex/dependency/deployment.lux b/stdlib/source/program/aedifex/dependency/deployment.lux index 84170965c..60fcd57d1 100644 --- a/stdlib/source/program/aedifex/dependency/deployment.lux +++ b/stdlib/source/program/aedifex/dependency/deployment.lux @@ -53,18 +53,18 @@ (do [! (try.with async.monad)] [_ (\ repository upload artifact data)] (case status - #///dependency/status.Unverified + {///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)))))) @@ -75,15 +75,15 @@ <md5> (format type ///artifact/extension.md5)] (list& type (case status - #///dependency/status.Unverified + {///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) @@ -91,39 +91,39 @@ (do try.monad [now (: (Try ///artifact/time.Time) (///artifact/time.of_instant now)) - .let [version_template (value@ #///artifact.version artifact) + .let [version_template (value@ ///artifact.#version artifact) snapshot (|> snapshot - (revised@ [#///metadata/snapshot.versioning #///artifact/versioning.snapshot] + (revised@ [///metadata/snapshot.#versioning ///artifact/versioning.#snapshot] (function (_ snapshot) (case snapshot - #///artifact/snapshot.Local - #///artifact/snapshot.Local + {///artifact/snapshot.#Local} + {///artifact/snapshot.#Local} - {#///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)]] + {///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 - (with@ [#///metadata/snapshot.versioning #///artifact/versioning.versions] - (list [#///artifact/snapshot/version.extension type - #///artifact/snapshot/version.value (///artifact/snapshot/version/value.format - [#///artifact/snapshot/version/value.version version_template - #///artifact/snapshot/version/value.snapshot versioning_snapshot]) - #///artifact/snapshot/version.updated now])) - ... (with@ [#///metadata/snapshot.versioning #///artifact/versioning.snapshot] - ... (list\composite (..artifacts type (product.right (value@ #///package.library package))) - ... (..artifacts ///artifact/type.pom (product.right (value@ #///package.pom package))))) + (with@ [///metadata/snapshot.#versioning ///artifact/versioning.#versions] + (list [///artifact/snapshot/version.#extension type + ///artifact/snapshot/version.#value (///artifact/snapshot/version/value.format + [///artifact/snapshot/version/value.#version version_template + ///artifact/snapshot/version/value.#snapshot versioning_snapshot]) + ///artifact/snapshot/version.#updated now])) + ... (with@ [///metadata/snapshot.#versioning ///artifact/versioning.#snapshot] + ... (list\composite (..artifacts type (product.right (value@ ///package.#library package))) + ... (..artifacts ///artifact/type.pom (product.right (value@ ///package.#pom package))))) )))) (def: .public (one repository [artifact type] package) (-> (Repository Async) Dependency Package (Async (Try Artifact))) (do [! async.monad] [now (async.future instant.now) - .let [version_template (value@ #///artifact.version artifact)]] + .let [version_template (value@ ///artifact.#version artifact)]] (do (try.with !) - [_ (with_status repository version_template [artifact type] (value@ #///package.library package)) + [_ (with_status repository version_template [artifact type] (value@ ///package.#library package)) - _ (let [[pom pom_data status] (value@ #///package.pom package)] + _ (let [[pom pom_data status] (value@ ///package.#pom package)] (with_status repository version_template [artifact ///artifact/type.pom] @@ -135,8 +135,8 @@ _ (///metadata/snapshot.write repository artifact snapshot) project (///metadata/artifact.read repository artifact) _ (|> project - (with@ #///metadata/artifact.versions (list version_template)) - (with@ #///metadata/artifact.last_updated now) + (with@ ///metadata/artifact.#versions (list version_template)) + (with@ ///metadata/artifact.#last_updated now) (///metadata/artifact.write repository artifact))] (in artifact)))) diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux index 3c8241595..12848cb58 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,17 +115,17 @@ 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)]))) + [{.#None} {.#None}] + {//status.#Unverified})]))) (def: .public (one repository dependency) (-> (Repository Async) Dependency (Async (Try Package))) @@ -133,10 +133,10 @@ extension (///artifact/extension.extension type)] (do (try.with async.monad) [snapshot (///metadata/snapshot.read repository artifact) - .let [version_template (value@ [#///metadata/snapshot.artifact #///artifact.version] snapshot) - artifact_version (value.format [#value.version version_template - #value.snapshot (value@ [#///metadata/snapshot.versioning #///artifact/versioning.snapshot] snapshot)]) - artifact (with@ #///artifact.version artifact_version artifact)] + .let [version_template (value@ [///metadata/snapshot.#artifact ///artifact.#version] snapshot) + artifact_version (value.format [value.#version version_template + value.#snapshot (value@ [///metadata/snapshot.#versioning ///artifact/versioning.#snapshot] snapshot)]) + artifact (with@ ///artifact.#version artifact_version artifact)] [pom_data pom_status] (..hashed repository version_template artifact ///artifact/extension.pom) library_&_status (..hashed repository version_template artifact extension)] (\ async.monad in @@ -144,9 +144,9 @@ [pom (\ utf8.codec decoded pom_data) pom (\ xml.codec decoded pom) profile (<xml>.result ///pom.parser (list pom))] - (in [#///package.origin {#///repository/origin.Remote ""} - #///package.library library_&_status - #///package.pom [pom pom_data pom_status]])))))) + (in [///package.#origin {///repository/origin.#Remote ""} + ///package.#library library_&_status + ///package.#pom [pom pom_data pom_status]])))))) (type: .public Resolution (Dictionary Dependency Package)) @@ -161,8 +161,8 @@ (exception: .public (cannot_resolve [dependency Dependency]) (exception.report - ["Artifact" (%.text (///artifact.format (value@ #//.artifact dependency)))] - ["Type" (%.text (value@ #//.type dependency))])) + ["Artifact" (%.text (///artifact.format (value@ //.#artifact dependency)))] + ["Type" (%.text (value@ //.#type dependency))])) (template [<sigil> <name> <doing> <at>] [(def: (<name> console repository artifact) @@ -182,24 +182,24 @@ (def: .public (any console repositories dependency) (-> (Console Async) (List (Repository Async)) Dependency (Async (Try Package))) (case repositories - #.End + {.#End} (|> dependency (exception.except ..cannot_resolve) (\ async.monad in)) - {#.Item repository alternatives} + {.#Item repository alternatives} (do [! async.monad] - [_ (..announce_fetching console repository (value@ #//.artifact dependency)) + [_ (..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))] + [_ (..announce_success console repository (value@ //.#artifact dependency))] (in outcome)) - {#try.Failure error} + {try.#Failure error} (do ! - [_ (..announce_failure console repository (value@ #//.artifact dependency))] + [_ (..announce_failure console repository (value@ //.#artifact dependency))] (any console alternatives dependency)))))) (def: .public (all console repositories new_repository dependencies resolution) @@ -213,12 +213,12 @@ dependencies dependencies resolution resolution] (case dependencies - #.End + {.#End} (\ async.monad in [successes failures resolution]) - {#.Item head tail} - (case (value@ [#//.artifact #///artifact.version] head) + {.#Item head tail} + (case (value@ [//.#artifact ///artifact.#version] head) ... Skip if there is no version "" (recur repositories successes @@ -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 + {.#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 150d3120b..0be99a0fe 100644 --- a/stdlib/source/program/aedifex/dependency/status.lux +++ b/stdlib/source/program/aedifex/dependency/status.lux @@ -12,7 +12,7 @@ (type: .public Status (Variant - #Unverified + {#Unverified} {#Partial (Either (Hash SHA-1) (Hash MD5))} {#Verified (Hash SHA-1) (Hash MD5)})) diff --git a/stdlib/source/program/aedifex/format.lux b/stdlib/source/program/aedifex/format.lux index 5f7669366..95b4bf30a 100644 --- a/stdlib/source/program/aedifex/format.lux +++ b/stdlib/source/program/aedifex/format.lux @@ -26,10 +26,10 @@ (`' [#name (~ (code.text name)) #url (~ (code.text url)) #type (~ (case type - #/.Repo + {/.#Repo} (' "repo") - #/.Manual + {/.#Manual} (' "manual")))])) (def: (organization [name url]) @@ -40,11 +40,11 @@ (def: (developer [name url organization]) (Format /.Developer) (case organization - #.None + {.#None} (`' [#name (~ (code.text name)) #url (~ (code.text url))]) - {#.Some value} + {.#Some value} (`' [#name (~ (code.text name)) #url (~ (code.text url)) #organization (~ (..organization value))]))) @@ -72,17 +72,17 @@ (All (_ a) (-> Text (Maybe a) (Format a) Aggregate Aggregate)) (case value - #.None + {.#None} aggregate - {#.Some value} + {.#Some value} (dictionary.has field (format value) aggregate))) (def: (on_list field value format aggregate) (All (_ a) (-> Text (List a) (Format a) Aggregate Aggregate)) (case value - #.End + {.#End} aggregate value @@ -110,13 +110,13 @@ (def: (info value) (Format /.Info) (|> ..empty - (..on_maybe "url" (value@ #/.url value) code.text) - (..on_maybe "scm" (value@ #/.scm value) code.text) - (..on_maybe "description" (value@ #/.description value) code.text) - (..on_list "licenses" (value@ #/.licenses value) ..license) - (..on_maybe "organization" (value@ #/.organization value) ..organization) - (..on_list "developers" (value@ #/.developers value) ..developer) - (..on_list "contributors" (value@ #/.contributors value) ..contributor) + (..on_maybe "url" (value@ /.#url value) code.text) + (..on_maybe "scm" (value@ /.#scm value) code.text) + (..on_maybe "description" (value@ /.#description value) code.text) + (..on_list "licenses" (value@ /.#licenses value) ..license) + (..on_maybe "organization" (value@ /.#organization value) ..organization) + (..on_list "developers" (value@ /.#developers value) ..developer) + (..on_list "contributors" (value@ /.#contributors value) ..contributor) ..aggregate)) (def: (artifact' [group name version]) @@ -144,25 +144,25 @@ (def: (profile value) (Format /.Profile) (`` (|> ..empty - (..on_list "parents" (value@ #/.parents value) code.text) - (..on_maybe "identity" (value@ #/.identity value) ..artifact) - (..on_maybe "info" (value@ #/.info value) ..info) - (..on_set "repositories" (value@ #/.repositories value) code.text) - (..on_set "dependencies" (value@ #/.dependencies value) ..dependency) - (dictionary.has "compiler" (..dependency (value@ #/.compiler value))) - (..on_set "sources" (value@ #/.sources value) code.text) - (dictionary.has "target" (code.text (value@ #/.target value))) - (..on_maybe "program" (value@ #/.program value) code.text) - (..on_maybe "test" (value@ #/.test value) code.text) - (..on_dictionary "deploy_repositories" (value@ #/.deploy_repositories value) code.text code.text) + (..on_list "parents" (value@ /.#parents value) code.text) + (..on_maybe "identity" (value@ /.#identity value) ..artifact) + (..on_maybe "info" (value@ /.#info value) ..info) + (..on_set "repositories" (value@ /.#repositories value) code.text) + (..on_set "dependencies" (value@ /.#dependencies value) ..dependency) + (dictionary.has "compiler" (..dependency (value@ /.#compiler value))) + (..on_set "sources" (value@ /.#sources value) code.text) + (dictionary.has "target" (code.text (value@ /.#target value))) + (..on_maybe "program" (value@ /.#program value) code.text) + (..on_maybe "test" (value@ /.#test value) code.text) + (..on_dictionary "deploy_repositories" (value@ /.#deploy_repositories value) code.text code.text) (~~ (template [<tag>] [(dictionary.has (template.text [<tag>]) (..runtime (value@ <tag> value)))] - [#/.java] - [#/.js] - [#/.python] - [#/.lua] - [#/.ruby])) + [/.#java] + [/.#js] + [/.#python] + [/.#lua] + [/.#ruby])) ..aggregate))) (def: .public project diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux index 4c2e3cd9f..4cbc77515 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,13 +125,13 @@ 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)] (recur tail (++ chunk) output)) - #.None + {.#None} (case (..hash_size input) 0 (constructor output) (^template [<size> <write>] diff --git a/stdlib/source/program/aedifex/input.lux b/stdlib/source/program/aedifex/input.lux index aa76979a8..024c4d0b2 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.lux b/stdlib/source/program/aedifex/metadata.lux index d0dbba2ba..83320d752 100644 --- a/stdlib/source/program/aedifex/metadata.lux +++ b/stdlib/source/program/aedifex/metadata.lux @@ -18,16 +18,16 @@ (def: .public (remote_artifact_uri artifact) (-> Artifact URI) (let [/ uri.separator] - (format (//artifact.directory / (value@ #//artifact.group artifact)) - / (value@ #//artifact.name artifact) - / (value@ #//artifact.version artifact) + (format (//artifact.directory / (value@ //artifact.#group artifact)) + / (value@ //artifact.#name artifact) + / (value@ //artifact.#version artifact) / ..remote_file))) (def: .public (remote_project_uri artifact) (-> Artifact URI) (let [/ uri.separator] - (format (//artifact.directory / (value@ #//artifact.group artifact)) - / (value@ #//artifact.name artifact) + (format (//artifact.directory / (value@ //artifact.#group artifact)) + / (value@ //artifact.#name artifact) / ..remote_file))) (def: local_file diff --git a/stdlib/source/program/aedifex/metadata/artifact.lux b/stdlib/source/program/aedifex/metadata/artifact.lux index d0bdf887e..ad0477dcc 100644 --- a/stdlib/source/program/aedifex/metadata/artifact.lux +++ b/stdlib/source/program/aedifex/metadata/artifact.lux @@ -59,10 +59,10 @@ (def: (time_format value) (%.Format Time) - (let [(^slots [#time.hour #time.minute #time.second]) (time.clock value)] - (%.format (..pad hour) - (..pad minute) - (..pad second)))) + (let [(^slots [time.#hour time.#minute time.#second]) (time.clock value)] + (%.format (..pad #hour) + (..pad #minute) + (..pad #second)))) (def: (instant_format value) (%.Format Instant) @@ -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,15 +94,15 @@ (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.#Node ..<metadata> xml.attributes (list (..group_format (value@ #group value)) (..name_format (value@ #name value)) - {#xml.Node ..<versioning> + {xml.#Node ..<versioning> xml.attributes (list (..versions_format (value@ #versions value)) (..last_updated_format (value@ #last_updated value)))})}) @@ -129,10 +129,10 @@ minute (<>.codec n.decimal (<text>.exactly 2 <text>.decimal)) second (<>.codec n.decimal (<text>.exactly 2 <text>.decimal))] (<>.lifted (time.time - [#time.hour hour - #time.minute minute - #time.second second - #time.milli_second 0])))) + [time.#hour hour + time.#minute minute + time.#second second + time.#milli_second 0])))) (def: last_updated_parser (Parser Instant) @@ -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 - (let [(^slots [#///artifact.group #///artifact.name]) artifact] - [#group group - #name name - #versions (list) - #last_updated ..epoch])})))) + {try.#Failure error} + (in {try.#Success + (let [(^slots [///artifact.#group ///artifact.#name]) artifact] + [..#group #group + ..#name #name + ..#versions (list) + ..#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 05a065c6f..c840fc870 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> (|>)] @@ -71,8 +71,8 @@ (def: .public (format (^slots [#artifact #versioning])) (-> Metadata XML) - (let [(^slots [#///artifact.group #///artifact.name #///artifact.version]) artifact] - {#xml.Node ..<metadata> + (let [(^slots [///artifact.#group ///artifact.#name ///artifact.#version]) artifact] + {xml.#Node ..<metadata> xml.attributes (list (..group_format group) (..name_format name) @@ -91,12 +91,12 @@ [group (<xml>.somewhere (..text ..<group>)) name (<xml>.somewhere (..text ..<name>)) version (<xml>.somewhere (..text ..<version>)) - versioning (with_expansions [<default_version> [#///artifact/snapshot/version.extension ///artifact/type.jvm_library - #///artifact/snapshot/version.value version - #///artifact/snapshot/version.updated ///artifact/time.epoch]] + versioning (with_expansions [<default_version> [///artifact/snapshot/version.#extension ///artifact/type.jvm_library + ///artifact/snapshot/version.#value version + ///artifact/snapshot/version.#updated ///artifact/time.epoch]] (|> (<xml>.somewhere ///artifact/versioning.parser) (\ ! each - (revised@ #///artifact/versioning.versions + (revised@ ///artifact/versioning.#versions (: (-> (List ///artifact/snapshot/version.Version) (List ///artifact/snapshot/version.Version)) (|>> (case> (^ (list)) @@ -104,12 +104,12 @@ versions versions))))) - (<>.else [#///artifact/versioning.snapshot #///artifact/snapshot.Local - #///artifact/versioning.last_updated ///artifact/time.epoch - #///artifact/versioning.versions (list <default_version>)])))] - (in [#artifact [#///artifact.group group - #///artifact.name name - #///artifact.version version] + (<>.else [///artifact/versioning.#snapshot {///artifact/snapshot.#Local} + ///artifact/versioning.#last_updated ///artifact/time.epoch + ///artifact/versioning.#versions (list <default_version>)])))] + (in [#artifact [///artifact.#group group + ///artifact.#name name + ///artifact.#version version] #versioning versioning])))) (def: .public equivalence @@ -128,15 +128,15 @@ (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]})))) diff --git a/stdlib/source/program/aedifex/package.lux b/stdlib/source/program/aedifex/package.lux index 923c69cbc..a80ae368d 100644 --- a/stdlib/source/program/aedifex/package.lux +++ b/stdlib/source/program/aedifex/package.lux @@ -44,20 +44,20 @@ _ false))] - [local? #//origin.Local] - [remote? #//origin.Remote] + [local? //origin.#Local] + [remote? //origin.#Remote] ) (def: .public (local pom library) (-> XML Binary Package) - [#origin {#//origin.Local ""} + [#origin {//origin.#Local ""} #library [library - {#//status.Verified (//hash.sha-1 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) + {//status.#Verified (//hash.sha-1 binary_pom) (//hash.md5 binary_pom)}])]) (def: .public dependencies @@ -66,7 +66,7 @@ product.left list (<xml>.result //pom.parser) - (try\each (value@ #/.dependencies)))) + (try\each (value@ /.#dependencies)))) (def: .public repositories (-> Package (Try (Set Address))) @@ -74,7 +74,7 @@ product.left list (<xml>.result //pom.parser) - (try\each (value@ #/.repositories)))) + (try\each (value@ /.#repositories)))) (def: .public equivalence (Equivalence Package) diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux index b3239d4e2..b42553a8e 100644 --- a/stdlib/source/program/aedifex/parser.lux +++ b/stdlib/source/program/aedifex/parser.lux @@ -31,10 +31,10 @@ (def: (as_input input) (-> (Maybe Code) (List Code)) (case input - {#.Some input} + {.#Some input} (list input) - #.None + {.#None} (list))) (def: (singular input tag parser) @@ -89,7 +89,7 @@ ($_ <>.and (..singular input "name" ..name) (..singular input "url" ..url) - (<>.else #/.Repo + (<>.else {/.#Repo} (..singular input "type" (<>.or (<code>.this! (' "repo")) (<code>.this! (' "manual")))))))) diff --git a/stdlib/source/program/aedifex/pom.lux b/stdlib/source/program/aedifex/pom.lux index e98730532..932a24207 100644 --- a/stdlib/source/program/aedifex/pom.lux +++ b/stdlib/source/program/aedifex/pom.lux @@ -47,25 +47,25 @@ (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] + {_.#Node ["" tag] _.attributes - (list {#_.Text value})}) + (list {_.#Text value})}) (def: (artifact value) (-> Artifact (List XML)) - (list (..property ..group_tag (value@ #//artifact.group value)) - (..property ..artifact_tag (value@ #//artifact.name value)) - (..property ..version_tag (value@ #//artifact.version value)))) + (list (..property ..group_tag (value@ //artifact.#group value)) + (..property ..artifact_tag (value@ //artifact.#name value)) + (..property ..version_tag (value@ //artifact.#version value)))) (def: distribution (-> /.Distribution XML) - (|>> (case> #/.Repo "repo" - #/.Manual "manual") + (|>> (case> {/.#Repo} "repo" + {/.#Manual} "manual") (..property "distribution"))) (def: (license [name url distribution]) @@ -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] + {_.#Node ["" ..dependency_tag] _.attributes - (list\composite (..artifact (value@ #//dependency.artifact value)) - (list (..property "type" (value@ #//dependency.type value))))}) + (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"] @@ -128,27 +128,27 @@ (def: (info value) (-> /.Info (List XML)) ($_ list\composite - (|> value (value@ #/.url) (maybe\each (..property ..url_tag)) maybe.list) - (|> value (value@ #/.description) (maybe\each (..property "description")) maybe.list) - (|> value (value@ #/.licenses) (list\each ..license) (..group "licenses") list) - (|> value (value@ #/.scm) (maybe\each ..scm) maybe.list) - (|> value (value@ #/.organization) (maybe\each ..organization) maybe.list) - (|> value (value@ #/.developers) (list\each ..developer) (..group "developers") list) - (|> value (value@ #/.contributors) (list\each ..contributor) (..group "contributors") list) + (|> value (value@ /.#url) (maybe\each (..property ..url_tag)) maybe.list) + (|> value (value@ /.#description) (maybe\each (..property "description")) maybe.list) + (|> value (value@ /.#licenses) (list\each ..license) (..group "licenses") list) + (|> value (value@ /.#scm) (maybe\each ..scm) maybe.list) + (|> value (value@ /.#organization) (maybe\each ..organization) maybe.list) + (|> value (value@ /.#developers) (list\each ..developer) (..group "developers") list) + (|> value (value@ /.#contributors) (list\each ..contributor) (..group "contributors") list) )) ) (def: .public (write value) (-> /.Profile (Try XML)) - (case (value@ #/.identity value) - {#.Some identity} - {#try.Success - {#_.Node ["" ..project_tag] _.attributes + (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) + (|> value (value@ /.#repositories) set.list (list\each ..repository) (..group "repositories") list) + (|> value (value@ /.#dependencies) set.list (list\each ..dependency) (..group ..dependencies_tag) list) )}} _ @@ -173,14 +173,14 @@ (do maybe.monad [group (dictionary.value ["" ..group_tag] properties) artifact (dictionary.value ["" ..artifact_tag] properties)] - (in [#//dependency.artifact [#//artifact.group group - #//artifact.name artifact - #//artifact.version (|> properties + (in [//dependency.#artifact [//artifact.#group group + //artifact.#name artifact + //artifact.#version (|> properties (dictionary.value ["" ..version_tag]) (maybe.else "") (text.replaced "${project.version}" own_version) (text.replaced "${project.parent.version}" parent_version))] - #//dependency.type (|> properties + //dependency.#type (|> properties (dictionary.value ["" "type"]) (maybe.else //artifact/type.jvm_library))]))))) @@ -225,7 +225,7 @@ (<>.else (list))) _ (<>.some <xml>.any)] (in (|> (\ /.monoid identity) - (revised@ #/.dependencies (function (_ empty) + (revised@ /.#dependencies (function (_ empty) (list\mix set.has empty dependencies))) - (revised@ #/.repositories (function (_ empty) + (revised@ /.#repositories (function (_ empty) (list\mix set.has empty repositories))))))))) diff --git a/stdlib/source/program/aedifex/profile.lux b/stdlib/source/program/aedifex/profile.lux index 2e3dc3da3..8ef0abbf4 100644 --- a/stdlib/source/program/aedifex/profile.lux +++ b/stdlib/source/program/aedifex/profile.lux @@ -34,13 +34,13 @@ (def: .public default_compiler Dependency - [#dependency.artifact ["com.github.luxlang" "lux-jvm" "0.6.0"] - #dependency.type type.jvm_library]) + [dependency.#artifact ["com.github.luxlang" "lux-jvm" "0.6.0"] + dependency.#type type.jvm_library]) (type: .public Distribution (Variant - #Repo - #Manual)) + {#Repo} + {#Manual})) (implementation: distribution_equivalence (Equivalence Distribution) @@ -48,7 +48,7 @@ (def: (= reference subject) (case [reference subject] (^template [<tag>] - [[<tag> <tag>] + [[{<tag>} {<tag>}] true]) ([#Repo] [#Manual]) @@ -122,11 +122,11 @@ (def: .public default_info Info - [#url #.None - #scm #.None - #description #.None + [#url {.#None} + #scm {.#None} + #description {.#None} #licenses (list) - #organization #.None + #organization {.#None} #developers (list) #contributors (list)]) @@ -215,15 +215,15 @@ (def: identity [#parents (list) - #identity #.None - #info #.None + #identity {.#None} + #info {.#None} #repositories (set.empty text.hash) #dependencies (set.empty dependency.hash) #compiler default_compiler #sources (set.empty text.hash) #target ..default_target - #program #.None - #test #.None + #program {.#None} + #test {.#None} #deploy_repositories (dictionary.empty text.hash) #java runtime.default_java #js runtime.default_js diff --git a/stdlib/source/program/aedifex/project.lux b/stdlib/source/program/aedifex/project.lux index acf3c3819..aedae9c64 100644 --- a/stdlib/source/program/aedifex/project.lux +++ b/stdlib/source/program/aedifex/project.lux @@ -54,22 +54,22 @@ (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} + (value@ //.#parents profile)) + {.#Some ouroboros} (exception.except ..circular_dependency [ouroboros name]) - #.None + {.#None} (do [! try.monad] [parents (monad.each ! (profile' (set.has name lineage) project) - (value@ #//.parents profile))] + (value@ //.#parents profile))] (in (list\mix (function (_ parent child) (\ //.monoid composite child parent)) - (with@ #//.parents (list) profile) + (with@ //.#parents (list) profile) parents)))) - #.None + {.#None} (exception.except ..unknown_profile [name]))) (def: .public profile diff --git a/stdlib/source/program/aedifex/repository.lux b/stdlib/source/program/aedifex/repository.lux index b836cfa54..365195828 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 508fcba28..e00c5f240 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/remote.lux b/stdlib/source/program/aedifex/repository/remote.lux index 269ff15a9..9f09b0993 100644 --- a/stdlib/source/program/aedifex/repository/remote.lux +++ b/stdlib/source/program/aedifex/repository/remote.lux @@ -65,15 +65,15 @@ [[status message] (: (IO (Try (@http.Response IO))) (http.get (format address uri) (http.headers ..base_headers) - #.None + {.#None} http))] (case status (^ (static http/status.ok)) - (\ ! each product.right ((value@ #@http.body message) #.None)) + (\ ! each product.right ((value@ #@http.body message) {.#None})) _ (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) @@ -81,15 +81,15 @@ [[status message] (: (IO (Try (@http.Response IO))) (http.put (format address uri) (http.headers (case identity - #.None + {.#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 f18f45e54..783502215 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)))) @@ -101,10 +101,10 @@ output (: (Dictionary file.Path Binary) (dictionary.empty text.hash))] (case pending - #.End + {.#End} (in output) - {#.Item head tail} + {.#Item head tail} (do ! [content (\ fs read head)] (recur tail @@ -131,12 +131,12 @@ (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) [.let [[compilation_sources compilation_host_dependencies compilation_libraries compilation_target compilation_module] compilation] - import (/import.import (value@ #platform.&file_system platform) compilation_libraries) + import (/import.import (value@ platform.#&file_system platform) compilation_libraries) [state archive phase_wrapper] (:sharing [<parameters>] (Platform <parameters>) platform @@ -152,9 +152,9 @@ (Async (Try [Archive (directive.State+ <parameters>)])) (:expected (platform.compile phase_wrapper import static expander platform compilation [archive state]))) - _ (ioW.freeze (value@ #platform.&file_system platform) static archive) + _ (ioW.freeze (value@ platform.#&file_system platform) static archive) program_context (async\in ($/program.context archive)) - host_dependencies (..load_host_dependencies (value@ #platform.&file_system platform) compilation_host_dependencies) + host_dependencies (..load_host_dependencies (value@ platform.#&file_system platform) compilation_host_dependencies) _ (..package! (for [@.old (file.async file.default) @.jvm (file.async file.default) @.js file.default]) @@ -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.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/export.lux b/stdlib/source/program/compositor/export.lux index 3588e1dde..90234875a 100644 --- a/stdlib/source/program/compositor/export.lux +++ b/stdlib/source/program/compositor/export.lux @@ -34,10 +34,10 @@ (def: no_ownership tar.Ownership (let [commons (: tar.Owner - [#tar.name tar.anonymous - #tar.id tar.no_id])] - [#tar.user commons - #tar.group commons])) + [tar.#name tar.anonymous + tar.#id tar.no_id])] + [tar.#user commons + tar.#group commons])) (def: .public (library fs sources) (-> (file.System Async) (List Source) (Async (Try tar.Tar))) @@ -51,7 +51,7 @@ (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 diff --git a/stdlib/source/program/compositor/import.lux b/stdlib/source/program/compositor/import.lux index 278e992fb..9b84e22c6 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 293b7f1e0..717df9bf4 100644 --- a/stdlib/source/specification/aedifex/repository.lux +++ b/stdlib/source/specification/aedifex/repository.lux @@ -29,17 +29,17 @@ [expected (_binary.random 100)] (in ($_ _.and' (do async.monad - [.let [good_uri (/remote.uri (value@ #//artifact.version valid_artifact) valid_artifact //artifact/extension.lux_library)] + [.let [good_uri (/remote.uri (value@ //artifact.#version valid_artifact) valid_artifact //artifact/extension.lux_library)] good_upload! (\ subject upload good_uri expected) good_download! (\ subject download good_uri) - .let [bad_uri (/remote.uri (value@ #//artifact.version invalid_artifact) invalid_artifact //artifact/extension.lux_library)] + .let [bad_uri (/remote.uri (value@ //artifact.#version invalid_artifact) invalid_artifact //artifact/extension.lux_library)] bad_upload! (\ subject upload bad_uri expected) bad_download! (\ subject download bad_uri)] (_.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 2668d36ca..832273cd3 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) + (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 007c2fbc4..bd8da0f38 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 diff --git a/stdlib/source/specification/compositor/common.lux b/stdlib/source/specification/compositor/common.lux index 31a1675f3..e5d3dab25 100644 --- a/stdlib/source/specification/compositor/common.lux +++ b/stdlib/source/specification/compositor/common.lux @@ -31,7 +31,7 @@ (generation.State+ anchor expression directive) what))) -(def: (runner (^slots [#platform.runtime #platform.phase #platform.host]) state) +(def: (runner (^slots [platform.#runtime platform.#phase platform.#host]) state) (Instancer Runner) (function (_ evaluation_name expressionS) (do try.monad @@ -42,7 +42,7 @@ (phase expressionS)))] (\ host evaluate! evaluation_name expressionG)))) -(def: (definer (^slots [#platform.runtime #platform.phase #platform.host]) +(def: (definer (^slots [platform.#runtime platform.#phase platform.#host]) state) (Instancer Definer) (function (_ lux_name expressionS) @@ -73,8 +73,8 @@ [?state (platform.initialize target expander analysis_bundle platform generation_bundle directive_bundle program extender)] (in (do try.monad [[directive_bundle directive_state] ?state - .let [generation_state (value@ [#directive.generation - #directive.state] + .let [generation_state (value@ [directive.#generation + directive.#state] directive_state)]] (in [[directive_bundle directive_state] (..runner platform generation_state) diff --git a/stdlib/source/specification/compositor/generation/case.lux b/stdlib/source/specification/compositor/generation/case.lux index eb27aea29..52689480e 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 @@ -85,9 +85,9 @@ [subS subP] case .let [right? (tail? size idx) caseS (synthesis.variant - [#analysis.lefts idx - #analysis.right? right? - #analysis.value subS]) + [analysis.#lefts idx + analysis.#right? right? + analysis.#value subS]) caseP ($_ synthesis.path/seq (if right? (synthesis.side/right idx) @@ -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_ @@ -219,7 +219,7 @@ 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] @@ -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 7aad9a7a7..eeaa68a94 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.#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" + (|> {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.#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,7 +128,7 @@ (`` ($_ _.and (~~ (template [<extension> <reference> <comp>] [(_.test <extension> - (|> {#synthesis.Extension <extension> (list (synthesis.f64 param) + (|> {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.#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" + (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" + (|> {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" + (|> {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" + (|> {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" + (|> {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" + (and (|> {synthesis.#Extension "lux try" (list (synthesis.function/abstraction - [#synthesis.environment (list) - #synthesis.arity 1 - #synthesis.body {#synthesis.Extension "lux io error" + [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" + (|> {synthesis.#Extension "lux try" (list (synthesis.function/abstraction - [#synthesis.environment (list) - #synthesis.arity 1 - #synthesis.body (synthesis.text message)]))} + [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/function.lux b/stdlib/source/specification/compositor/generation/function.lux index 1708264a2..9a2f68a8a 100644 --- a/stdlib/source/specification/compositor/generation/function.lux +++ b/stdlib/source/specification/compositor/generation/function.lux @@ -43,9 +43,9 @@ local (..local arity)] (in [arity local (synthesis.function/abstraction - [#synthesis.environment (list) - #synthesis.arity arity - #synthesis.body (synthesis.variable/local local)])]))) + [synthesis.#environment (list) + synthesis.#arity arity + synthesis.#body (synthesis.variable/local local)])]))) (def: .public (spec run) (-> Runner Test) @@ -57,39 +57,39 @@ inputsS (list\each (|>> synthesis.f64) inputs)]] ($_ _.and (_.test "Can read arguments." - (|> (synthesis.function/apply [#synthesis.function functionS - #synthesis.arguments inputsS]) + (|> (synthesis.function/apply [synthesis.#function functionS + synthesis.#arguments inputsS]) (run "with_local") (//case.verify expectation))) (_.test "Can partially apply functions." (or (n.= 1 arity) (let [preS (list.first partial_arity inputsS) postS (list.after partial_arity inputsS) - partialS (synthesis.function/apply [#synthesis.function functionS - #synthesis.arguments preS])] - (|> (synthesis.function/apply [#synthesis.function partialS - #synthesis.arguments postS]) + partialS (synthesis.function/apply [synthesis.#function functionS + synthesis.#arguments preS])] + (|> (synthesis.function/apply [synthesis.#function partialS + synthesis.#arguments postS]) (run "partial_application") (//case.verify expectation))))) (_.test "Can read environment." (or (n.= 1 arity) (let [environment (|> partial_arity (enum.range n.enum 1) - (list\each (|>> #reference.Local))) + (list\each (|>> {reference.#Local}))) variableS (if (n.<= partial_arity local) (synthesis.variable/foreign (-- local)) (synthesis.variable/local (|> local (n.- partial_arity)))) inner_arity (n.- partial_arity arity) innerS (synthesis.function/abstraction - [#synthesis.environment environment - #synthesis.arity inner_arity - #synthesis.body variableS]) + [synthesis.#environment environment + synthesis.#arity inner_arity + synthesis.#body variableS]) outerS (synthesis.function/abstraction - [#synthesis.environment (list) - #synthesis.arity partial_arity - #synthesis.body innerS])] - (|> (synthesis.function/apply [#synthesis.function outerS - #synthesis.arguments inputsS]) + [synthesis.#environment (list) + synthesis.#arity partial_arity + synthesis.#body innerS])] + (|> (synthesis.function/apply [synthesis.#function outerS + synthesis.#arguments inputsS]) (run "with_foreign") (//case.verify expectation))))) ))) diff --git a/stdlib/source/specification/compositor/generation/primitive.lux b/stdlib/source/specification/compositor/generation/primitive.lux index 670b30d30..f4bf220a4 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 d98e660e0..a8391f63a 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 c98013875..1b98fc558 100644 --- a/stdlib/source/specification/compositor/generation/structure.lux +++ b/stdlib/source/specification/compositor/generation/structure.lux @@ -36,13 +36,13 @@ .let [last?_in (|> num_tags -- (n.= tag_in))] value_in r.i64] (_.test (%.name (name_of synthesis.variant)) - (|> (synthesis.variant [#analysis.lefts (if last?_in + (|> (synthesis.variant [analysis.#lefts (if last?_in (-- tag_in) tag_in) - #analysis.right? last?_in - #analysis.value (synthesis.i64 value_in)]) + 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,17 +50,17 @@ 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 + {.#None} (not last?_in)) same_value? (|> value_out (:as Int) (i.= value_in))] (and same_tag? 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 f30d9c94c..979cc60e6 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 e2f73db67..5ca3f7c05 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 3c6679dd7..ea5913175 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 5fa846019..bd0ac70b4 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 8daf8635c..a6532c250 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot/version/value.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot/version/value.lux @@ -47,18 +47,18 @@ (do random.monad [sample random stamp $///stamp.random] - (let [version (value@ #/.version sample) + (let [version (value@ /.#version sample) local! (text\= version - (/.format (with@ #/.snapshot #///.Local sample))) + (/.format (with@ /.#snapshot {///.#Local} sample))) - remote_format (/.format [#/.version (format version /.snapshot) - #/.snapshot {#///.Remote stamp}]) + remote_format (/.format [/.#version (format version /.snapshot) + /.#snapshot {///.#Remote stamp}]) remote! - (and (text.starts_with? (format version (///time.format (value@ #///stamp.time stamp))) + (and (text.starts_with? (format version (///time.format (value@ ///stamp.#time stamp))) remote_format) - (text.ends_with? (%.nat (value@ #///stamp.build stamp)) + (text.ends_with? (%.nat (value@ ///stamp.#build stamp)) remote_format))] (_.cover [/.snapshot /.format] (and local! diff --git a/stdlib/source/test/aedifex/artifact/time/date.lux b/stdlib/source/test/aedifex/artifact/time/date.lux index 77c312380..b32787d49 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/artifact/time/time.lux b/stdlib/source/test/aedifex/artifact/time/time.lux index 6351eca60..c908eb69b 100644 --- a/stdlib/source/test/aedifex/artifact/time/time.lux +++ b/stdlib/source/test/aedifex/artifact/time/time.lux @@ -19,7 +19,9 @@ (def: .public random (Random /.Time) - (random.one (|>> time.clock (with@ #time.milli_second 0) time.time) + (random.one (|>> time.clock + (with@ time.#milli_second 0) + time.time) random.time)) (def: .public test diff --git a/stdlib/source/test/aedifex/cache.lux b/stdlib/source/test/aedifex/cache.lux index 338feb5fa..84b8aaa02 100644 --- a/stdlib/source/test/aedifex/cache.lux +++ b/stdlib/source/test/aedifex/cache.lux @@ -57,7 +57,7 @@ (try.maybe (do try.monad [pom (//pom.write profile) - identity (try.of_maybe (value@ #//.identity profile))] + identity (try.of_maybe (value@ //.#identity profile))] (in [identity profile pom])))) @profile.random)) @@ -73,9 +73,9 @@ [[identity profile pom] ..profile type ..type content ..content] - (in [[#//dependency.artifact identity - #//dependency.type type] - (with@ #//package.origin {#//repository/origin.Remote ""} (//package.local pom content))]))) + (in [[//dependency.#artifact identity + //dependency.#type type] + (with@ //package.#origin {//repository/origin.#Remote ""} (//package.local pom content))]))) (def: resolution (Random Resolution) @@ -88,14 +88,14 @@ (do ! [pom (random.one (function (_ [identity profile pom]) (|> profile - (with@ #//.dependencies (set.empty //dependency.hash)) - (with@ #//.identity {#.Some (value@ #//dependency.artifact dependency)}) + (with@ //.#dependencies (set.empty //dependency.hash)) + (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 e41f3e44c..d08d5f1a1 100644 --- a/stdlib/source/test/aedifex/cli.lux +++ b/stdlib/source/test/aedifex/cli.lux @@ -53,20 +53,20 @@ (def: (compilation_format value) (-> /.Compilation (List Text)) (case value - #/.Build (list "build") - #/.Test (list "test"))) + {/.#Build} (list "build") + {/.#Test} (list "test"))) (def: (format value) (-> /.Command (List Text)) (case value - #/.Version (list "version") - #/.Clean (list "clean") - #/.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)))) + {/.#Version} (list "version") + {/.#Clean} (list "clean") + {/.#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)))) (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 57aca92d2..307946212 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 @@ -77,14 +77,14 @@ .let [empty_profile (: Profile (\ ///.monoid identity)) with_target (: (-> Profile Profile) - (with@ #///.target target)) + (with@ ///.#target target)) with_program (: (-> Profile Profile) - (with@ #///.program {#.Some program})) + (with@ ///.#program {.#Some program})) profile (|> empty_profile with_program with_target - (with@ #///.sources (set.of_list text.hash (list source))))] + (with@ ///.#sources (set.of_list text.hash (list source))))] home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) @@ -103,23 +103,23 @@ _ (\ watcher poll [])] (do [! async.monad] [no_dangling_process! (|> profile - (with@ #///.compiler compiler) + (with@ ///.#compiler compiler) ((/.do! 1 watcher command) ($version.echo "") (program.async (program.mock environment.empty home working_directory)) 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! + (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 1376d440a..ee69f1010 100644 --- a/stdlib/source/test/aedifex/command/build.lux +++ b/stdlib/source/test/aedifex/command/build.lux @@ -41,85 +41,85 @@ (-> 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) (exception.except shell.no_more_output [])) - (def: (on_error state) + (def: (on_fail 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) (exception.except shell.no_more_output [])) - (def: (on_error state) + (def: (on_fail 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 + {.#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 + {.#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) (do random.monad [lux_version (random.ascii/alpha 5) - .let [js_compiler [#///dependency.artifact [#///artifact.group /.lux_group - #///artifact.name /.js_compiler_name - #///artifact.version lux_version] - #///dependency.type ///artifact/type.js_library]]] + .let [js_compiler [///dependency.#artifact [///artifact.#group /.lux_group + ///artifact.#name /.js_compiler_name + ///artifact.#version lux_version] + ///dependency.#type ///artifact/type.js_library]]] (`` ($_ random.either (in js_compiler) (~~ (template [<compiler>] - [(in [#///dependency.artifact [#///artifact.group /.lux_group - #///artifact.name <compiler> - #///artifact.version lux_version] - #///dependency.type ///artifact/type.lux_library])] + [(in [///dependency.#artifact [///artifact.#group /.lux_group + ///artifact.#name <compiler> + ///artifact.#version lux_version] + ///dependency.#type ///artifact/type.lux_library])] [/.jvm_compiler_name] [/.python_compiler_name] @@ -151,9 +151,9 @@ .let [empty_profile (: Profile (\ ///.monoid identity)) with_target (: (-> Profile Profile) - (with@ #///.target target)) + (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 "")] @@ -185,7 +185,7 @@ [verdict (do ///action.monad [_ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs shell resolution - (with@ #///.compiler compiler profile)) + (with@ ///.#compiler compiler profile)) start (\ console read_line []) end (\ console read_line [])] (in (and (text\= /.start start) @@ -207,7 +207,7 @@ [verdict (do ///action.monad [_ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs (shell.async (..bad_shell [])) resolution - (with@ #///.compiler compiler profile)) + (with@ ///.#compiler compiler profile)) start (\ console read_line []) end (\ console read_line [])] (in (and (text\= /.start start) @@ -232,12 +232,12 @@ 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)))] + {try.#Success})))] (in (and (text\= expected/0 actual/0) (text\= expected/1 actual/1) (text\= expected/2 actual/2) diff --git a/stdlib/source/test/aedifex/command/clean.lux b/stdlib/source/test/aedifex/command/clean.lux index 83c3e5a80..7d3e57392 100644 --- a/stdlib/source/test/aedifex/command/clean.lux +++ b/stdlib/source/test/aedifex/command/clean.lux @@ -103,7 +103,7 @@ context_exists!/pre (..directory_exists? fs context) target_exists!/pre (..assets_exist? fs target_path direct_files) sub_exists!/pre (..assets_exist? fs sub_path sub_files) - _ (/.do! console fs (with@ #///.target target_path dummy)) + _ (/.do! console fs (with@ ///.#target target_path dummy)) context_exists!/post (..directory_exists? fs context) target_exists!/post (..assets_exist? fs target_path direct_files) sub_exists!/post (..assets_exist? fs sub_path sub_files) diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux index 219a2931b..0b0f8558b 100644 --- a/stdlib/source/test/aedifex/command/deploy.lux +++ b/stdlib/source/test/aedifex/command/deploy.lux @@ -55,7 +55,7 @@ (Async (Try Text))) (do ///action.monad [.let [console ($version.echo "")] - _ ($install.make_sources! fs (value@ #///.sources profile)) + _ ($install.make_sources! fs (value@ ///.#sources profile)) _ (/.do! console repository fs artifact profile)] (\ console read_line []))) @@ -66,7 +66,7 @@ [[artifact expected_pom profile] (random.one (function (_ profile) (do maybe.monad - [artifact (value@ #///.identity profile) + [artifact (value@ ///.#identity profile) expected_pom (try.maybe (///pom.write profile))] (in [artifact expected_pom profile]))) $profile.random) @@ -81,19 +81,19 @@ [verdict (do [! ///action.monad] [logging (..execute! program repository fs artifact profile) expected_library (|> profile - (value@ #///.sources) + (value@ ///.#sources) set.list (export.library fs) (\ ! each (format.result tar.writer))) - actual_pom (\ repository download (///repository/remote.uri (value@ #///artifact.version artifact) artifact ///artifact/extension.pom)) - actual_library (\ repository download (///repository/remote.uri (value@ #///artifact.version artifact) artifact ///artifact/extension.lux_library)) - actual_sha-1 (\ repository download (///repository/remote.uri (value@ #///artifact.version artifact) artifact (format ///artifact/extension.lux_library ///artifact/extension.sha-1))) + actual_pom (\ repository download (///repository/remote.uri (value@ ///artifact.#version artifact) artifact ///artifact/extension.pom)) + actual_library (\ repository download (///repository/remote.uri (value@ ///artifact.#version artifact) artifact ///artifact/extension.lux_library)) + actual_sha-1 (\ repository download (///repository/remote.uri (value@ ///artifact.#version artifact) artifact (format ///artifact/extension.lux_library ///artifact/extension.sha-1))) actual_sha-1 (\ async.monad in (do try.monad [actual_sha-1 (\ utf8.codec decoded actual_sha-1)] (\ ///hash.sha-1_codec decoded actual_sha-1))) - actual_md5 (\ repository download (///repository/remote.uri (value@ #///artifact.version artifact) artifact (format ///artifact/extension.lux_library ///artifact/extension.md5))) + actual_md5 (\ repository download (///repository/remote.uri (value@ ///artifact.#version artifact) artifact (format ///artifact/extension.lux_library ///artifact/extension.md5))) actual_md5 (\ async.monad in (do try.monad [actual_md5 (\ utf8.codec decoded actual_md5)] diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux index 8cf0ea05c..037a8e119 100644 --- a/stdlib/source/test/aedifex/command/deps.lux +++ b/stdlib/source/test/aedifex/command/deps.lux @@ -67,31 +67,31 @@ [_ dependee_package] $///package.random [_ depender_package] $///package.random - .let [dependee [#///dependency.artifact dependee_artifact - #///dependency.type ///artifact/type.lux_library] - depender [#///dependency.artifact depender_artifact - #///dependency.type ///artifact/type.lux_library] + .let [dependee [///dependency.#artifact dependee_artifact + ///dependency.#type ///artifact/type.lux_library] + depender [///dependency.#artifact depender_artifact + ///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@ #///.dependencies (set.of_list ///dependency.hash (list dependee))) + (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.pom [dependee_pom + (with@ ///package.#origin {///repository/origin.#Remote ""}) + (with@ ///package.#pom [dependee_pom (|> dependee_pom (\ xml.codec encoded) (\ utf8.codec encoded)) - #///dependency/status.Unverified])) + {///dependency/status.#Unverified}])) depender_package (|> depender_package - (with@ #///package.origin {#///repository/origin.Remote ""}) - (with@ #///package.pom [depender_pom + (with@ ///package.#origin {///repository/origin.#Remote ""}) + (with@ ///package.#pom [depender_pom (|> depender_pom (\ xml.codec encoded) (\ utf8.codec encoded)) - #///dependency/status.Unverified])) + {///dependency/status.#Unverified}])) fs (file.mock (\ file.default separator)) program (program.async (program.mock environment.empty home working_directory))]] @@ -103,7 +103,7 @@ (dictionary.has dependee dependee_package) (///dependency/deployment.all local)) post (|> (\ ///.monoid identity) - (with@ #///.dependencies (set.of_list ///dependency.hash (list dependee depender))) + (with@ ///.#dependencies (set.of_list ///dependency.hash (list dependee depender))) (/.do! console local (list (///repository.mock ($///dependency/resolution.single depender_artifact depender_package) [])) diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux index ac1a87be1..0461029fc 100644 --- a/stdlib/source/test/aedifex/command/install.lux +++ b/stdlib/source/test/aedifex/command/install.lux @@ -56,7 +56,7 @@ (-> (Program Async) (file.System Async) ///.Profile (Async (Try Text))) (do ///action.monad [.let [console ($version.echo "")] - _ (..make_sources! fs (value@ #///.sources sample)) + _ (..make_sources! fs (value@ ///.#sources sample)) _ (/.do! console fs (///repository/local.repository program fs) sample)] (\ console read_line []))) @@ -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) @@ -75,7 +75,7 @@ [.let [fs (file.mock /) program (program.async (program.mock environment.empty home working_directory)) - artifact_path (///local.uri (value@ #///artifact.version identity) identity) + artifact_path (///local.uri (value@ ///artifact.#version identity) identity) library_path (format artifact_path ///artifact/extension.lux_library) pom_path (format artifact_path ///artifact/extension.pom)] verdict (do [! ///action.monad] @@ -84,11 +84,11 @@ library_exists! (|> library_path (format home /) (\ fs file?) - (\ async.monad each (|>> #try.Success))) + (\ async.monad each (|>> {try.#Success}))) pom_exists! (|> pom_path (format home /) (\ fs file?) - (\ async.monad each (|>> #try.Success)))] + (\ async.monad each (|>> {try.#Success})))] (in (and succeeded! library_exists! pom_exists!)))] @@ -97,7 +97,7 @@ (in (do [! async.monad] [.let [fs (file.mock /) program (program.async (program.mock environment.empty home working_directory))] - logging (..execute! program fs (with@ #///.identity #.None sample))] + logging (..execute! program fs (with@ ///.#identity {.#None} sample))] (_.cover' [/.failure] (|> logging (try\each (text\= /.failure)) diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux index ac080c966..76cdf8b02 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,11 +60,11 @@ (_.cover' [/.do! /.success] (try.else false verdict))) - {#try.Failure error} + {try.#Failure error} (_.cover' [/.do!] - (case (value@ #///.identity sample) - {#.Some _} + (case (value@ ///.#identity sample) + {.#Some _} false - #.None + {.#None} true)))))))) diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux index 19ae5cd70..cee27dd27 100644 --- a/stdlib/source/test/aedifex/command/test.lux +++ b/stdlib/source/test/aedifex/command/test.lux @@ -50,9 +50,9 @@ .let [empty_profile (: Profile (\ ///.monoid identity)) with_target (: (-> Profile Profile) - (with@ #///.target target)) + (with@ ///.#target target)) with_test (: (-> Profile Profile) - (with@ #///.test {#.Some test})) + (with@ ///.#test {.#Some test})) profile (|> empty_profile with_test @@ -65,7 +65,7 @@ [verdict (do ///action.monad [_ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs (shell.async (@build.good_shell [])) resolution - (with@ #///.compiler compiler profile)) + (with@ ///.#compiler compiler profile)) build_start (\ console read_line []) build_end (\ console read_line []) test_start (\ console read_line []) @@ -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,17 +91,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 (if (list.any? (text\= "build") actual_arguments) + {try.#Success [state (if (list.any? (text\= "build") actual_arguments) shell.normal shell.error)]})))}) [])] _ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs (shell.async bad_shell) resolution - (with@ #///.compiler compiler profile)) + (with@ ///.#compiler compiler profile)) build_start (\ console read_line []) build_end (\ console read_line []) test_start (\ console read_line []) diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux index 6cd59b3a5..583e21fcd 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 7e137443b..625c7c9f5 100644 --- a/stdlib/source/test/aedifex/dependency/deployment.lux +++ b/stdlib/source/test/aedifex/dependency/deployment.lux @@ -55,7 +55,7 @@ [#@http.headers (http.headers (list)) #@http.body (function (_ _) (|> [0 (binary.empty 0)] - #try.Success + {try.#Success} io.io))]]) (type: Cache @@ -68,31 +68,31 @@ (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) (let [url (: (-> URI URL) (|>> (format address))) - library_url (url (format (artifact.uri (value@ #artifact.version expected_artifact) + library_url (url (format (artifact.uri (value@ artifact.#version expected_artifact) expected_artifact) artifact/extension.lux_library)) - pom_url (url (format (artifact.uri (value@ #artifact.version expected_artifact) + pom_url (url (format (artifact.uri (value@ artifact.#version expected_artifact) expected_artifact) artifact/extension.pom)) artifact_metadata_url (url (metadata.remote_artifact_uri expected_artifact)) project_metadata_url (url (metadata.remote_project_uri expected_artifact)) expected_library (|> package - (value@ #package.library) + (value@ package.#library) product.left) expected_pom (|> package - (value@ #package.pom) + (value@ package.#pom) product.right product.left) @@ -136,7 +136,7 @@ (do random.monad [[profile package] $///package.random .let [artifact (|> profile - (value@ #profile.identity) + (value@ profile.#identity) maybe.trusted) dependency (: Dependency [artifact @@ -155,7 +155,7 @@ .let [cache (: Cache (atom.atom (dictionary.empty text.hash))) http (..http cache) - repository (repository.async (remote.repository http #.None address))]] + repository (repository.async (remote.repository http {.#None} address))]] (in (do async.monad [?outcome (/.one repository dependency package) cache (async.future (atom.read! cache))] @@ -178,7 +178,7 @@ cache (: Cache (atom.atom (dictionary.empty text.hash))) http (..http cache) - repository (repository.async (remote.repository http #.None address))]] + repository (repository.async (remote.repository http {.#None} address))]] (in (do async.monad [?outcome (/.all repository resolution) cache (async.future (atom.read! cache))] diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux index 69867d5f8..b8b50f23d 100644 --- a/stdlib/source/test/aedifex/dependency/resolution.lux +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -53,8 +53,8 @@ (do [! random.monad] [artifact $///artifact.random [_ package] $///package.random] - (in (dictionary.has [#///dependency.artifact artifact - #///dependency.type ///artifact/type.lux_library] + (in (dictionary.has [///dependency.#artifact artifact + ///dependency.#type ///artifact/type.lux_library] package /.empty)))) @@ -92,13 +92,13 @@ (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)) - (let [expected (///artifact.uri (value@ #///artifact.version artifact) artifact)] + (let [expected (///artifact.uri (value@ ///artifact.#version artifact) artifact)] (implementation (def: the_description "[1]") @@ -106,37 +106,37 @@ (if (text.contains? expected uri) (let [library (: Binary (|> package - (value@ #///package.library) + (value@ ///package.#library) product.left)) pom (: Binary (|> package - (value@ #///package.pom) + (value@ ///package.#pom) product.left (\ 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)) @@ -144,52 +144,52 @@ (def: the_description "[~SHA-1]") (def: (on_download uri state) - (if (text.contains? (///artifact.uri (value@ #///artifact.version expected_artifact) expected_artifact) uri) + (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 - (value@ #///package.library) + {try.#Success [state (|> expected_package + (value@ ///package.#library) product.left)]} (text.ends_with? ..lux_sha-1 uri) - {#try.Success [state (|> expected_package - (value@ #///package.library) + {try.#Success [state (|> expected_package + (value@ ///package.#library) product.left ..sha-1)]} (text.ends_with? ..lux_md5 uri) - {#try.Success [state (|> expected_package - (value@ #///package.library) + {try.#Success [state (|> expected_package + (value@ ///package.#library) product.left ..md5)]} (text.ends_with? ///artifact/extension.pom uri) - {#try.Success [state (|> expected_package - (value@ #///package.pom) + {try.#Success [state (|> expected_package + (value@ ///package.#pom) product.left (\ xml.codec encoded) (\ utf8.codec encoded))]} (text.ends_with? ..pom_sha-1 uri) - {#try.Success [state (|> dummy_package - (value@ #///package.pom) + {try.#Success [state (|> dummy_package + (value@ ///package.#pom) product.left (\ xml.codec encoded) (\ utf8.codec encoded) ..sha-1)]} (text.ends_with? ..pom_md5 uri) - {#try.Success [state (|> expected_package - (value@ #///package.pom) + {try.#Success [state (|> expected_package + (value@ ///package.#pom) product.left (\ xml.codec encoded) (\ utf8.codec encoded) ..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)) @@ -197,52 +197,52 @@ (def: the_description "[~MD5]") (def: (on_download uri state) - (if (text.contains? (///artifact.uri (value@ #///artifact.version expected_artifact) expected_artifact) uri) + (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 - (value@ #///package.library) + {try.#Success [state (|> expected_package + (value@ ///package.#library) product.left)]} (text.ends_with? ..lux_sha-1 uri) - {#try.Success [state (|> expected_package - (value@ #///package.library) + {try.#Success [state (|> expected_package + (value@ ///package.#library) product.left ..sha-1)]} (text.ends_with? ..lux_md5 uri) - {#try.Success [state (|> dummy_package - (value@ #///package.library) + {try.#Success [state (|> dummy_package + (value@ ///package.#library) product.left ..md5)]} (text.ends_with? ///artifact/extension.pom uri) - {#try.Success [state (|> expected_package - (value@ #///package.pom) + {try.#Success [state (|> expected_package + (value@ ///package.#pom) product.left (\ xml.codec encoded) (\ utf8.codec encoded))]} (text.ends_with? ..pom_sha-1 uri) - {#try.Success [state (|> expected_package - (value@ #///package.pom) + {try.#Success [state (|> expected_package + (value@ ///package.#pom) product.left (\ xml.codec encoded) (\ utf8.codec encoded) ..sha-1)]} (text.ends_with? ..pom_md5 uri) - {#try.Success [state (|> dummy_package - (value@ #///package.pom) + {try.#Success [state (|> dummy_package + (value@ ///package.#pom) product.left (\ xml.codec encoded) (\ utf8.codec encoded) ..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 @@ -250,7 +250,7 @@ [expected_artifact $///artifact.random [_ expected_package] $///package.random [_ dummy_package] (random.only (|>> product.right - (with@ #///package.pom (value@ #///package.pom expected_package)) + (with@ ///package.#pom (value@ ///package.#pom expected_package)) (\ ///package.equivalence = expected_package) not) $///package.random) @@ -260,28 +260,28 @@ (`` ($_ _.and (in (do async.monad [actual_package (/.one (///repository.mock good []) - [#///dependency.artifact expected_artifact - #///dependency.type ///artifact/type.lux_library])] + [///dependency.#artifact expected_artifact + ///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 [actual_package (/.one (///repository.mock <bad> []) - [#///dependency.artifact expected_artifact - #///dependency.type ///artifact/type.lux_library])] + [///dependency.#artifact expected_artifact + ///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] @@ -295,7 +295,7 @@ [expected_artifact $///artifact.random [_ expected_package] $///package.random [_ dummy_package] (random.only (|>> product.right - (with@ #///package.pom (value@ #///package.pom expected_package)) + (with@ ///package.#pom (value@ ///package.#pom expected_package)) (\ ///package.equivalence = expected_package) not) $///package.random) @@ -309,30 +309,30 @@ (list (///repository.mock bad_sha-1 []) (///repository.mock bad_md5 []) (///repository.mock good [])) - [#///dependency.artifact expected_artifact - #///dependency.type ///artifact/type.lux_library])] + [///dependency.#artifact expected_artifact + ///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 "")] actual_package (/.any console (list (///repository.mock bad_sha-1 []) (///repository.mock bad_md5 [])) - [#///dependency.artifact expected_artifact - #///dependency.type ///artifact/type.lux_library])] + [///dependency.#artifact expected_artifact + ///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)))) ))) @@ -358,41 +358,41 @@ [_ depender_package] $///package.random [_ ignored_package] $///package.random - .let [dependee [#///dependency.artifact dependee_artifact - #///dependency.type ///artifact/type.lux_library] - depender [#///dependency.artifact depender_artifact - #///dependency.type ///artifact/type.lux_library] - ignored [#///dependency.artifact ignored_artifact - #///dependency.type ///artifact/type.lux_library] + .let [dependee [///dependency.#artifact dependee_artifact + ///dependency.#type ///artifact/type.lux_library] + depender [///dependency.#artifact depender_artifact + ///dependency.#type ///artifact/type.lux_library] + ignored [///dependency.#artifact ignored_artifact + ///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@ #///.dependencies (set.of_list ///dependency.hash (list dependee))) + (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) - dependee_package (with@ #///package.pom + dependee_package (with@ ///package.#pom [dependee_pom (|> dependee_pom (\ xml.codec encoded) (\ utf8.codec encoded)) - #///dependency/status.Unverified] + {///dependency/status.#Unverified}] dependee_package) - depender_package (with@ #///package.pom + depender_package (with@ ///package.#pom [depender_pom (|> depender_pom (\ xml.codec encoded) (\ utf8.codec encoded)) - #///dependency/status.Unverified] + {///dependency/status.#Unverified}] depender_package) - ignored_package (with@ #///package.pom + ignored_package (with@ ///package.#pom [ignored_pom (|> ignored_pom (\ xml.codec encoded) (\ utf8.codec encoded)) - #///dependency/status.Unverified] + {///dependency/status.#Unverified}] ignored_package)]] (in [[dependee depender ignored] [dependee_package depender_package ignored_package]]))) diff --git a/stdlib/source/test/aedifex/dependency/status.lux b/stdlib/source/test/aedifex/dependency/status.lux index 79e59460f..ea39e0cf5 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 049023718..eb3886755 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/input.lux b/stdlib/source/test/aedifex/input.lux index cf7f59840..cec84de94 100644 --- a/stdlib/source/test/aedifex/input.lux +++ b/stdlib/source/test/aedifex/input.lux @@ -45,7 +45,7 @@ Test (<| (_.covering /._) (do [! random.monad] - [expected (\ ! each (with@ #//.parents (list)) $profile.random) + [expected (\ ! each (with@ //.#parents (list)) $profile.random) .let [fs (: (file.System Async) (file.mock (\ file.default separator)))]] (in (do async.monad @@ -60,8 +60,8 @@ (/.read async.monad fs (list //.default)))] (in (\ //.equivalence = (|> expected - (revised@ #//.sources ..with_default_source) - (revised@ #//.repositories ..with_default_repository)) + (revised@ //.#sources ..with_default_source) + (revised@ //.#repositories ..with_default_repository)) actual)))] (_.cover' [/.read] (try.else false verdict))))))) diff --git a/stdlib/source/test/aedifex/local.lux b/stdlib/source/test/aedifex/local.lux index bd49df4c8..a2a943921 100644 --- a/stdlib/source/test/aedifex/local.lux +++ b/stdlib/source/test/aedifex/local.lux @@ -23,5 +23,5 @@ ($_ _.and (_.cover [/.repository /.uri] (text.starts_with? /.repository - (/.uri (value@ #//artifact.version sample) sample))) + (/.uri (value@ //artifact.#version sample) sample))) )))) diff --git a/stdlib/source/test/aedifex/metadata/artifact.lux b/stdlib/source/test/aedifex/metadata/artifact.lux index a1d3133c5..5708eb39b 100644 --- a/stdlib/source/test/aedifex/metadata/artifact.lux +++ b/stdlib/source/test/aedifex/metadata/artifact.lux @@ -60,10 +60,10 @@ month (month.by_number month) date (date.date year month day_of_month) time (time.time - [#time.hour hour - #time.minute minute - #time.second second - #time.milli_second 0])] + [time.#hour hour + time.#minute minute + time.#second second + time.#milli_second 0])] (in (instant.of_date_time date time)))))))) (def: .public test @@ -72,10 +72,10 @@ (_.for [/.Metadata]) (do random.monad [expected ..random - .let [artifact [#///artifact.group (value@ #/.group expected) - #///artifact.name (value@ #/.name expected) - #///artifact.version (|> expected - (value@ #/.versions) + .let [artifact [///artifact.#group (value@ /.#group expected) + ///artifact.#name (value@ /.#name expected) + ///artifact.#version (|> expected + (value@ /.#versions) list.head (maybe.else ""))]]] ($_ _.and @@ -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 52f7a1562..069cefcd2 100644 --- a/stdlib/source/test/aedifex/metadata/snapshot.lux +++ b/stdlib/source/test/aedifex/metadata/snapshot.lux @@ -64,16 +64,16 @@ month (month.by_number month) date (date.date year month day_of_month) time (time.time - [#time.hour hour - #time.minute minute - #time.second second - #time.milli_second 0])] + [time.#hour hour + time.#minute minute + time.#second second + time.#milli_second 0])] (in (instant.of_date_time date time))))))) (def: random_versioning (Random Versioning) ($_ random.and - (random\in #///snapshot.Local) + (random\in {///snapshot.#Local}) $///artifact/time.random (random.list 5 $///artifact/snapshot/version.random) )) @@ -91,7 +91,7 @@ (_.for [/.Metadata]) (do random.monad [expected ..random - .let [artifact (value@ #/.artifact expected)]] + .let [artifact (value@ /.#artifact expected)]] ($_ _.and (_.for [/.equivalence] ($equivalence.spec /.equivalence ..random)) @@ -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 69d31ddcc..8f8285c49 100644 --- a/stdlib/source/test/aedifex/package.lux +++ b/stdlib/source/test/aedifex/package.lux @@ -64,25 +64,25 @@ ($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) + (let [expected_pom (|> package (value@ /.#pom) product.left) + expected_library (|> package (value@ /.#library) product.left) local (/.local expected_pom expected_library) - [actual_pom binary_pom pom_status] (value@ #/.pom local) - [actual_library library_status] (value@ #/.library local)] - (and (case (value@ #/.origin local) - {#//origin.Local ""} true + [actual_pom binary_pom pom_status] (value@ /.#pom local) + [actual_library library_status] (value@ /.#library local)] + (and (case (value@ /.#origin local) + {//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,26 +97,26 @@ (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)) _ false)))))) (_.cover [/.dependencies] - (let [expected (value@ #//.dependencies profile)] + (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)] + (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 3dc073f0d..fea31184f 100644 --- a/stdlib/source/test/aedifex/parser.lux +++ b/stdlib/source/test/aedifex/parser.lux @@ -55,7 +55,7 @@ (def: with_default_sources (-> //.Profile //.Profile) - (revised@ #//.sources + (revised@ //.#sources (: (-> (Set //.Source) (Set //.Source)) (function (_ sources) (if (set.empty? sources) @@ -64,7 +64,7 @@ (def: with_default_repository (-> //.Profile //.Profile) - (revised@ #//.repositories (set.has //.default_repository))) + (revised@ //.#repositories (set.has //.default_repository))) (def: (with_empty_profile project) (-> Project Project) @@ -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 4913df25d..dff414e66 100644 --- a/stdlib/source/test/aedifex/pom.lux +++ b/stdlib/source/test/aedifex/pom.lux @@ -34,22 +34,22 @@ [expected @profile.random] (_.cover [/.write /.parser] (case [(/.write expected) - (value@ #//.identity expected)] - [{#try.Success pom} - {#.Some _}] + (value@ //.#identity expected)] + [{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))) + (with@ //.#dependencies (value@ //.#dependencies expected)) + (with@ //.#repositories (value@ //.#repositories expected))) actual) - {#try.Failure error} + {try.#Failure error} false) - [{#try.Failure error} - #.None] + [{try.#Failure error} + {.#None}] (exception.match? //.no_identity error) _ diff --git a/stdlib/source/test/aedifex/profile.lux b/stdlib/source/test/aedifex/profile.lux index 7a0bcb279..cd5491c33 100644 --- a/stdlib/source/test/aedifex/profile.lux +++ b/stdlib/source/test/aedifex/profile.lux @@ -154,10 +154,10 @@ (text\= "" /.default)) (_.cover [/.default_compiler] (|> (\ /.monoid identity) - (value@ #/.compiler) + (value@ /.#compiler) (same? /.default_compiler))) (_.cover [/.default_target] (|> (\ /.monoid identity) - (value@ #/.target) + (value@ /.#target) (same? /.default_target))) ))))) diff --git a/stdlib/source/test/aedifex/project.lux b/stdlib/source/test/aedifex/project.lux index 767f8cdb3..aa3d726c3 100644 --- a/stdlib/source/test/aedifex/project.lux +++ b/stdlib/source/test/aedifex/project.lux @@ -27,7 +27,7 @@ (def: profile (Random [//.Name //.Profile]) (|> @profile.random - (random\each (with@ #//.parents (list))) + (random\each (with@ //.#parents (list))) (random.and (random.ascii/alpha 1)))) (def: .public random @@ -66,11 +66,11 @@ .let [project ($_ (\ /.monoid composite) (/.project super_name super_profile) (/.project dummy_name dummy_profile) - (/.project sub_name (with@ #//.parents (list super_name) sub_profile))) + (/.project sub_name (with@ //.#parents (list super_name) sub_profile))) circular ($_ (\ /.monoid composite) - (/.project super_name (with@ #//.parents (list sub_name) super_profile)) + (/.project super_name (with@ //.#parents (list sub_name) super_profile)) (/.project dummy_name dummy_profile) - (/.project sub_name (with@ #//.parents (list super_name) sub_profile)))]] + (/.project sub_name (with@ //.#parents (list super_name) sub_profile)))]] ($_ _.and (_.cover [/.profile] (and (|> (/.profile project super_name) @@ -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 e65503ee9..9cc73f6c8 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 + {.#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 b6d647bb9..5d3c94565 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 443ab884e..9cea986a8 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)) @@ -45,18 +45,18 @@ [#@http.headers (http.headers (list)) #@http.body (..url_body "")]]] (<| io.io - #try.Success + {try.#Success} (if (|> headers (dictionary.value "User-Agent") (maybe\each (same? /.user_agent)) (maybe.else false)) (case [method input] - [#@http.Get #.None] + [#@http.Get {.#None}] [http/status.ok [#@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))) @@ -75,7 +75,7 @@ (implementation (def: (request method url headers input) (<| io.io - #try.Success + {try.#Success} [http/status.bad_request [#@http.headers (http.headers (list)) #@http.body (..url_body "")]])))) @@ -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! @@ -110,22 +110,22 @@ (try.else false))))) (_.cover [/.upload_failure] (let [repo (/.repository (..good_http user password) - #.None + {.#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 + {.#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/aedifex/runtime.lux b/stdlib/source/test/aedifex/runtime.lux index 0e5b72b01..77f7bcbed 100644 --- a/stdlib/source/test/aedifex/runtime.lux +++ b/stdlib/source/test/aedifex/runtime.lux @@ -44,7 +44,7 @@ (~~ (template [<command>] [(_.cover [/.default_java /.default_js /.default_python /.default_lua /.default_ruby] (let [listing (|> (list /.default_java /.default_js /.default_python /.default_lua /.default_ruby) - (list\each (value@ #/.program))) + (list\each (value@ /.#program))) unique (set.of_list text.hash listing)] (n.= (list.size listing) (set.size unique))))] @@ -57,10 +57,10 @@ )) (_.cover [/.for] (let [runtime' (/.for runtime path)] - (and (text\= (value@ #/.program runtime) - (value@ #/.program runtime')) + (and (text\= (value@ /.#program runtime) + (value@ /.#program runtime')) (|> runtime' - (value@ #/.parameters) + (value@ /.#parameters) list.last (maybe\each (text\= path)) (maybe.else false))))) diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 6a6ef3fac..46d467058 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)) ))) @@ -321,12 +321,6 @@ (/.' .example_identifier)) (code\= (code.identifier [..current_module "example_identifier"]) (/.' ..example_identifier)) - (code\= (code.tag ["" "example"]) - (/.' #example)) - (code\= (code.tag [/.prelude_module "example"]) - (/.' #.example)) - (code\= (code.tag [..current_module "example"]) - (/.' #..example)) (code\= (code.form (list (code.nat 6) (code.int +7) (code.rev .8))) (/.' (6 +7 .8))) (code\= (code.variant (list (code.frac +9.0) @@ -357,12 +351,6 @@ (/.` .example_identifier)) (code\= (code.identifier [..current_module "example_identifier"]) (/.` ..example_identifier)) - (code\= (code.tag [..current_module "example"]) - (/.` #example)) - (code\= (code.tag [/.prelude_module "example"]) - (/.` #.example)) - (code\= (code.tag [..current_module "example"]) - (/.` #..example)) (code\= (code.form (list (code.nat 6) (code.int +7) (code.rev .8))) (/.` (6 +7 .8))) (code\= (code.variant (list (code.frac +9.0) @@ -392,12 +380,6 @@ (/.`' .example_identifier)) (code\= (code.identifier [..current_module "example_identifier"]) (/.`' ..example_identifier)) - (code\= (code.tag ["" "example"]) - (/.`' #example)) - (code\= (code.tag [/.prelude_module "example"]) - (/.`' #.example)) - (code\= (code.tag [..current_module "example"]) - (/.`' #..example)) (code\= (code.form (list (code.nat 6) (code.int +7) (code.rev .8))) (/.`' (6 +7 .8))) (code\= (code.variant (list (code.frac +9.0) @@ -425,7 +407,7 @@ )) (_.cover [/.Ann] (|> example - (value@ #/.meta) + (value@ /.#meta) (location\= location.dummy))) ))) @@ -436,14 +418,14 @@ "This is an arbitrary text whose only purpose is to be found, somewhere, in the source-code.") (/.macro: (found_crosshair? tokens lux) - (let [[_ _ source_code] (value@ #.source lux)] - {#.Right [lux (list (code.bit (text.contains? ..crosshair source_code)))]})) + (let [[_ _ source_code] (value@ .#source lux)] + {.#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))] @@ -467,7 +449,7 @@ (/.type: for_type/variant (Variant - #Case/0 + {#Case/0} {#Case/1 Nat} {#Case/2 Int Text})) @@ -487,7 +469,7 @@ expected_left random.nat expected_right random.nat - .let [existential_type (\ ! each (|>> #.Ex) random.nat)] + .let [existential_type (\ ! each (|>> {.#Ex}) random.nat)] expected/0 existential_type expected/1 existential_type] (<| (_.for [/.Type]) @@ -518,7 +500,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 +508,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)) @@ -836,11 +818,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 +872,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 +932,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] @@ -970,8 +952,8 @@ (_.cover [/.^slots] (/.case [#left expected_nat #right expected_int] (/.^slots [#left #right]) - (and (/.same? expected_nat left) - (/.same? expected_int right)))) + (and (/.same? expected_nat #left) + (/.same? expected_int #right)))) (_.cover [/.^] (/.case [#left expected_nat #right expected_int] (/.^ (!pair 0 +0)) true @@ -1074,23 +1056,23 @@ (syntax: (for_meta|Info []) (function (_ lux) - (let [info (value@ #.info lux) + (let [info (value@ .#info lux) conforming_target! - (set.member? ..possible_targets (value@ #.target info)) + (set.member? ..possible_targets (value@ .#target info)) compiling! - (case (value@ #.mode info) - #.Build true + (case (value@ .#mode info) + {.#Build} true _ false)] - {#.Right [lux (list (code.bit (and conforming_target! + {.#Right [lux (list (code.bit (and conforming_target! compiling!)))]}))) (syntax: (for_meta|Module_State []) (do meta.monad [prelude_module (meta.module .prelude_module)] - (in (list (code.bit (case (value@ #.module_state prelude_module) - #.Active false + (in (list (code.bit (case (value@ .#module_state prelude_module) + {.#Active} false _ true)))))) (def: for_meta @@ -1126,40 +1108,40 @@ let/2 <code>.local_identifier let/3 <code>.local_identifier]) - (in (list (code.bit (case (value@ #.scopes *lux*) + (in (list (code.bit (case (value@ .#scopes *lux*) (^ (list& scope/2 _)) - (let [locals/2 (value@ #.locals scope/2) + (let [locals/2 (value@ .#locals scope/2) expected_locals/2 (set.of_list text.hash (list fn/2 var/2 let/2 let/3)) actual_locals/2 (|> locals/2 - (value@ #.mappings) + (value@ .#mappings) (list\each product.left) (set.of_list text.hash)) correct_locals! - (and (n.= 4 (value@ #.counter locals/2)) + (and (n.= 4 (value@ .#counter locals/2)) (set\= expected_locals/2 actual_locals/2)) - captured/2 (value@ #.captured scope/2) + captured/2 (value@ .#captured scope/2) 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) (function (_ is? name) (|> captured/2 - (value@ #.mappings) + (value@ .#mappings) (plist.value name) (maybe\each (|>> product.right is?)) (maybe.else false)))) correct_closure! - (and (n.= 6 (value@ #.counter captured/2)) + (and (n.= 6 (value@ .#counter captured/2)) (binding? local? fn/1) (binding? local? var/1) (binding? local? let/1) diff --git a/stdlib/source/test/lux/abstract/apply.lux b/stdlib/source/test/lux/abstract/apply.lux index d7c6495c3..3a63d3f34 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 aadf0d0e2..6c4f334d3 100644 --- a/stdlib/source/test/lux/abstract/codec.lux +++ b/stdlib/source/test/lux/abstract/codec.lux @@ -22,7 +22,7 @@ (let [field "value"] (implementation (def: encoded - (|>> #json.Boolean + (|>> {json.#Boolean} [field] list json.object)) @@ -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 5e2807e53..856c20d1a 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))) @@ -47,7 +47,7 @@ tail) product.left) - #.End + {.#End} false)] (and (n.= expected_size (list.size range)) expected_start? diff --git a/stdlib/source/test/lux/abstract/equivalence.lux b/stdlib/source/test/lux/abstract/equivalence.lux index 799a657cb..c0d5ad8ec 100644 --- a/stdlib/source/test/lux/abstract/equivalence.lux +++ b/stdlib/source/test/lux/abstract/equivalence.lux @@ -45,10 +45,10 @@ (implementation (def: (= left right) (case [left right] - [#.End #.End] + [{.#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 97540f00e..7f3f078aa 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 8fc9c96a8..f3275ef62 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 3cc54444b..d31ebfd62 100644 --- a/stdlib/source/test/lux/abstract/predicate.lux +++ b/stdlib/source/test/lux/abstract/predicate.lux @@ -80,10 +80,10 @@ (/.rec (function (_ recur) (function (_ values) (case values - #.End + {.#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 d1bb1d315..593e14bd8 100644 --- a/stdlib/source/test/lux/control/concatenative.lux +++ b/stdlib/source/test/lux/control/concatenative.lux @@ -73,8 +73,8 @@ (||> (/.push sample) <function>)))] - [/.||L #.Left] - [/.||R #.Right])) + [/.||L .#Left] + [/.||R .#Right])) (_.cover [/.dip] (n.= (++ sample) (||> (/.push sample) diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux index 2767082b2..108257528 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 @@ -52,7 +52,7 @@ .let [as_mail (: (All (_ a) (-> (-> a a) (/.Mail a))) (function (_ transform) (function (_ state actor) - (|> state transform #try.Success async\in)))) + (|> state transform {try.#Success} async\in)))) ++! (: (/.Mail Nat) (as_mail ++)) --! (: (/.Mail Nat) (as_mail --))]] (<| (_.covering /._) @@ -87,17 +87,17 @@ (in (do async.monad [_ (async.future (do io.monad [actor (/.spawn! (: (/.Behavior Any Any) - [#/.on_init (|>>) - #/.on_mail (function (_ message state self) + [/.#on_init (|>>) + /.#on_mail (function (_ message state self) (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,10 +105,10 @@ result (async.future (async.value read))] (_.cover' [/.poisoned] (case result - {#.Some error} + {.#Some error} (exception.match? /.poisoned error) - #.None + {.#None} false))))) (in (do async.monad @@ -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 f117f57f5..57fec6c78 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 c46d0da92..fcefb15ec 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) _ @@ -51,15 +51,15 @@ (case amount_of_polls 0 (do async.monad [_ (async.future (\ sink close))] - (in #.End)) + (in {.#End})) _ (do [! async.monad] [event channel] (case event - #.None - (in #.End) + {.#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,10 +148,10 @@ _ (atom.update! (row.suffix value) sink)] (if (n.< (list.size inputs) (++ (row.size current))) - (in {#.Some []}) + (in {.#Some []}) (do ! [_ (!signal [])] - (in #.None))))) + (in {.#None}))))) (/.sequential 0 (list\composite inputs inputs)))) _ ?signal listened (|> sink @@ -212,9 +212,9 @@ (/.iterations (function (_ [iterations current]) (async.resolved (if (n.< max_iterations iterations) - {#.Some [[(++ iterations) (n.+ shift current)] + {.#Some [[(++ iterations) (n.+ shift current)] current]} - #.None)))) + {.#None})))) /.list)] (_.cover' [/.iterations] (and (n.= max_iterations (list.size actual)) diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux index 44b2241f3..da3c90bae 100644 --- a/stdlib/source/test/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux @@ -45,10 +45,10 @@ [result (async.within ..delay (/.wait! semaphore))] (_.cover' [/.semaphore] (case result - {#.Some _} + {.#Some _} true - #.None + {.#None} false))))) (do [! random.monad] [initial_open_positions (|> random.nat (\ ! each (|>> (n.% 10) (n.max 1)))) @@ -58,10 +58,10 @@ result (async.within ..delay (/.wait! semaphore))] (_.cover' [/.wait!] (case result - {#.Some _} + {.#Some _} false - #.None + {.#None} true))))) (do [! random.monad] [initial_open_positions (|> random.nat (\ ! each (|>> (n.% 10) (n.max 1)))) @@ -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) _ @@ -145,10 +145,10 @@ [raw random.nat] (_.cover [/.Limit /.limit] (case [raw (/.limit raw)] - [0 #.None] + [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 9fcea56e8..cdabfb8d0 100644 --- a/stdlib/source/test/lux/control/continuation.lux +++ b/stdlib/source/test/lux/control/continuation.lux @@ -72,15 +72,15 @@ (/.Cont (List Nat) (List Nat))) (function (visit xs) (case xs - #.End - (_\in #.End) + {.#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 1a0d26c86..6df9238fc 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 3e50834a7..45cb6f8fd 100644 --- a/stdlib/source/test/lux/control/function/contract.lux +++ b/stdlib/source/test/lux/control/function/contract.lux @@ -25,21 +25,21 @@ (_.cover [/.pre /.pre_condition_failed] (case (try (/.pre (n.even? expected) true)) - {#try.Success output} + {try.#Success output} output - {#try.Failure error} - (and (text.contains? (value@ #exception.label /.pre_condition_failed) + {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} - (and (text.contains? (value@ #exception.label /.post_condition_failed) + {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 2cdce3830..14cce16b3 100644 --- a/stdlib/source/test/lux/control/maybe.lux +++ b/stdlib/source/test/lux/control/maybe.lux @@ -34,7 +34,7 @@ ($equivalence.spec (/.equivalence n.equivalence) (random.maybe random.nat))) (_.for [/.hash] (|> random.nat - (\ random.monad each (|>> #.Some)) + (\ random.monad each (|>> {.#Some})) ($hash.spec (/.hash n.hash)))) (_.for [/.monoid] ($monoid.spec (/.equivalence n.equivalence) /.monoid (random.maybe random.nat))) @@ -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) _ @@ -65,24 +65,24 @@ value random.nat] (_.cover [/.else] (and (same? default (/.else default - #.None)) + {.#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 119bfebb6..611459da0 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,11 +99,11 @@ (_.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)) - (match #.None + (match {.#None} #1)))) (_.cover [/.some] (and (|> (list\each code.nat expected+) @@ -112,7 +112,7 @@ (\ (list.equivalence n.equivalence) = expected+ actual))) (|> (list\each (|>> .int code.int) expected+) (/.result (/.some <code>.nat)) - (match #.End + (match {.#End} #1)))) (_.cover [/.many] (and (|> (list\each code.nat expected+) @@ -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 392e66382..521bd8927 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 40e2fa301..7b57b1547 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 @@ -105,7 +105,6 @@ random.safe_frac ..random_text ..random_name - ..random_name random_sequence random_sequence random_sequence @@ -131,7 +130,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 +149,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 +167,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 +187,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 +206,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 +219,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 +231,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 +245,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 +259,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 +272,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 +281,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 +295,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 +309,7 @@ (/.or /.any (<>.and /.nat recur)))))) - (!expect (^multi {#try.Success actual} + (!expect (^multi {try.#Success actual} (\ (list.equivalence n.equivalence) = expected actual)))))) @@ -325,13 +324,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 +338,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 +350,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 +365,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 +379,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 fe10e5ccd..d8d936cd1 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 400aea243..501e2d4ab 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] @@ -75,9 +75,7 @@ [/.frac /.frac! random.safe_frac code.frac frac.equivalence] [/.text /.text! (random.unicode 1) code.text text.equivalence] [/.identifier /.identifier! ..random_name code.identifier name.equivalence] - [/.tag /.tag! ..random_name code.tag name.equivalence] [/.local_identifier /.local_identifier! (random.unicode 1) code.local_identifier text.equivalence] - [/.local_tag /.local_tag! (random.unicode 1) code.local_tag text.equivalence] )) (~~ (template [<query> <code>] [(do [! random.monad] @@ -87,7 +85,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 +100,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 +113,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 +131,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 dbef40a52..06d06bc53 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 ad35703ab..6728343fb 100644 --- a/stdlib/source/test/lux/control/parser/json.lux +++ b/stdlib/source/test/lux/control/parser/json.lux @@ -46,14 +46,14 @@ (_.for [/.Parser]) (`` ($_ _.and (do [! random.monad] - [expected (\ ! each (|>> #json.String) (random.unicode 1))] + [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 _}))) + (|> (/.result /.null {json.#Null}) + (!expect {try.#Success _}))) (~~ (template [<query> <test> <check> <random> <json> <equivalence>] [(do [! random.monad] [expected <random> @@ -61,46 +61,46 @@ ($_ _.and (_.cover [<query>] (|> (/.result <query> {<json> expected}) - (!expect (^multi {#try.Success actual} + (!expect (^multi {try.#Success actual} (\ <equivalence> = expected actual))))) (_.cover [<test>] (and (|> (/.result (<test> expected) {<json> expected}) - (!expect {#try.Success #1})) + (!expect {try.#Success #1})) (|> (/.result (<test> expected) {<json> dummy}) - (!expect {#try.Success #0})))) + (!expect {try.#Success #0})))) (_.cover [<check>] (and (|> (/.result (<check> expected) {<json> expected}) - (!expect {#try.Success _})) + (!expect {try.#Success _})) (|> (/.result (<check> expected) {<json> dummy}) - (!expect {#try.Failure _}))))))] + (!expect {try.#Failure _}))))))] - [/.boolean /.boolean? /.boolean! random.bit #json.Boolean bit.equivalence] - [/.number /.number? /.number! ..safe_frac #json.Number frac.equivalence] - [/.string /.string? /.string! (random.unicode 1) #json.String text.equivalence] + [/.boolean /.boolean? /.boolean! random.bit json.#Boolean bit.equivalence] + [/.number /.number? /.number! ..safe_frac json.#Number frac.equivalence] + [/.string /.string? /.string! (random.unicode 1) json.#String text.equivalence] )) (do [! random.monad] [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} - (\ (maybe.equivalence text.equivalence) = #.None actual)))) - (|> (/.result (/.nullable /.string) {#json.String expected}) - (!expect (^multi {#try.Success actual} - (\ (maybe.equivalence text.equivalence) = {#.Some expected} actual))))))) + (and (|> (/.result (/.nullable /.string) {json.#Null}) + (!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))))))) (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))] + [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\each (|>> {json.#String})) (list.zipped/2 keys) (dictionary.of_list text.hash))}) - (!expect (^multi {#try.Success actual} + (!expect (^multi {try.#Success actual} (\ (dictionary.equivalence text.equivalence) = expected actual)))))) )))) diff --git a/stdlib/source/test/lux/control/parser/synthesis.lux b/stdlib/source/test/lux/control/parser/synthesis.lux index 67906c0a1..161ee54bc 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 8377f6b4b..b340e8450 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 d99273be5..f0bf2a2a0 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 3d27819bd..3e26eb4ab 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 511f56e78..7b87831a8 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,14 +62,14 @@ (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))] + [expected (\ ! each (|>> {xml.#Text}) (random.ascii/alpha 1))] (_.cover [/.any] (|> (/.result /.any (list expected)) (try\each (xml\= expected)) @@ -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,14 +100,14 @@ (|> (/.result (<| (/.node expected_tag) (//.after (/.attribute expected_attribute)) (//\in [])) - (list {#xml.Node expected_tag + (list {xml.#Node expected_tag (|> (dictionary.empty name.hash) (dictionary.has expected_attribute expected_value)) (list)})) - (!expect {#try.Success []})))) + (!expect {try.#Success []})))) (!failure /.unknown_attribute [[(/.attribute ["" expected]) - {#xml.Node [expected expected] + {xml.#Node [expected expected] (|> (dictionary.empty name.hash) (dictionary.has [expected ""] expected)) (list)}]]) @@ -115,39 +115,39 @@ [[(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] + {xml.#Node [expected expected] (dictionary.empty name.hash) (list)}] [(do //.monad [_ /.any] (/.node [expected expected] (/.attribute [expected expected]))) - {#xml.Node [expected expected] + {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 da88cb31e..9bdd575f7 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 3b210813d..704aaed01 100644 --- a/stdlib/source/test/lux/control/remember.lux +++ b/stdlib/source/test/lux/control/remember.lux @@ -38,28 +38,28 @@ (~ (code.text (%.date deadline))) (~ (code.text message)) (~+ (case focus - #.None (list) - {#.Some focus} (list focus)))))) + {.#None} (list) + {.#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) (and (text.contains? (%.date deadline) failure) (text.contains? message failure) (case focus - #.None + {.#None} true - {#.Some focus} + {.#Some focus} (text.contains? (%.code focus) failure)))) (syntax: (test_macro [macro <code>.identifier @@ -73,32 +73,32 @@ message (product.right (random.result prng ..message)) 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_succeed0 (..attempt (macro.expansion (..memory macro tomorrow message #.None))) - should_succeed1 (..attempt (macro.expansion (..memory macro tomorrow message {#.Some expected})))] + [should_fail0 (..attempt (macro.expansion (..memory macro yesterday message {.#None}))) + 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})))] (in (list (code.bit (and (case should_fail0 - {#try.Failure error} - (and (test_failure yesterday message #.None 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) _ @@ -114,10 +114,10 @@ focus ..focus] ($_ _.and (_.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}])))) + (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}])))) (_.cover [/.remember] (..test_macro /.remember "")) (_.cover [/.to_do] diff --git a/stdlib/source/test/lux/control/security/policy.lux b/stdlib/source/test/lux/control/security/policy.lux index 810020b02..63448cef6 100644 --- a/stdlib/source/test/lux/control/security/policy.lux +++ b/stdlib/source/test/lux/control/security/policy.lux @@ -48,21 +48,21 @@ (Ex (_ %) (-> Any (Policy %))) (/.with_policy (: (Context Privacy Policy) - (function (_ (^@ privilege (^open "%\[0]"))) + (function (_ (^@ privilege (^open "%[0]"))) (implementation (def: &hash (implementation (def: &equivalence (implementation (def: (= reference sample) - (text\= (%\can_downgrade reference) - (%\can_downgrade sample))))) + (text\= (%#can_downgrade reference) + (%#can_downgrade sample))))) (def: hash - (|>> %\can_downgrade + (|>> %#can_downgrade (\ text.hash hash))))) (def: password - %\can_upgrade) + %#can_upgrade) (def: privilege privilege)))))) @@ -81,18 +81,18 @@ /.Safety /.Safe /.Can_Trust /.Can_Distrust] ($_ _.and (_.for [/.functor] - ($functor.spec (..injection (\ policy_0 can_upgrade)) (..comparison (\ policy_0 can_downgrade)) /.functor)) + ($functor.spec (..injection (\ policy_0 #can_upgrade)) (..comparison (\ policy_0 #can_downgrade)) /.functor)) (_.for [/.apply] - ($apply.spec (..injection (\ policy_0 can_upgrade)) (..comparison (\ policy_0 can_downgrade)) /.apply)) + ($apply.spec (..injection (\ policy_0 #can_upgrade)) (..comparison (\ policy_0 #can_downgrade)) /.apply)) (_.for [/.monad] - ($monad.spec (..injection (\ policy_0 can_upgrade)) (..comparison (\ policy_0 can_downgrade)) /.monad)))) + ($monad.spec (..injection (\ policy_0 #can_upgrade)) (..comparison (\ policy_0 #can_downgrade)) /.monad)))) (_.cover [/.Privilege /.Context /.with_policy] (and (\ policy_0 = password password) (n.= (\ text.hash hash raw_password) (\ policy_0 hash password)))) (let [policy_1 (policy []) - delegate (/.delegation (\ policy_0 can_downgrade) (\ policy_1 can_upgrade))] + delegate (/.delegation (\ policy_0 #can_downgrade) (\ policy_1 #can_upgrade))] (_.cover [/.Delegation /.delegation] (\ policy_1 = (delegate password) (delegate password)))) )))) diff --git a/stdlib/source/test/lux/control/try.lux b/stdlib/source/test/lux/control/try.lux index 3e38574b2..6c05f2e53 100644 --- a/stdlib/source/test/lux/control/try.lux +++ b/stdlib/source/test/lux/control/try.lux @@ -23,7 +23,7 @@ (def: injection (Injection Try) - (|>> #/.Success)) + (|>> {/.#Success})) (def: comparison (Comparison Try) @@ -57,28 +57,28 @@ (_.cover [/.trusted] (n.= expected - (/.trusted {#/.Success expected}))) + (/.trusted {/.#Success expected}))) (_.cover [/.of_maybe] - (case [(/.of_maybe {#.Some expected}) - (/.of_maybe #.None)] - [{#/.Success actual} {#/.Failure _}] + (case [(/.of_maybe {.#Some expected}) + (/.of_maybe {.#None})] + [{/.#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 d301efd1c..ca497af1c 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) _ @@ -138,19 +138,19 @@ (and (\ /.equivalence = sample (/.after 0 sample)) (\ /.equivalence = (/.empty 0) (/.after size sample)) (case (list.reversed (..as_list sample)) - #.End + {.#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 243d77203..0337bd12a 100644 --- a/stdlib/source/test/lux/data/collection/array.lux +++ b/stdlib/source/test/lux/data/collection/array.lux @@ -59,33 +59,33 @@ (_.cover [/.example] (\ (maybe.equivalence n.equivalence) = (/.example n.even? the_array) - (list.example n.even? (/.list #.None the_array)))) + (list.example n.even? (/.list {.#None} the_array)))) (_.cover [/.example+] (case [(/.example n.even? the_array) (/.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)) - #.None + {.#None} false) - [#.None #.None] + [{.#None} {.#None}] true _ false)) (_.cover [/.every?] (\ bit.equivalence = - (list.every? n.even? (/.list #.None the_array)) + (list.every? n.even? (/.list {.#None} the_array)) (/.every? n.even? the_array))) (_.cover [/.any?] (\ bit.equivalence = - (list.any? n.even? (/.list #.None the_array)) + (list.any? n.even? (/.list {.#None} the_array)) (/.any? n.even? the_array))) ))) @@ -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)) @@ -184,22 +184,22 @@ (do ! [the_list (random.list size random.nat) .let [the_array (/.clone the_array) - members (|> the_array (/.list #.None) (set.of_list n.hash))] + members (|> the_array (/.list {.#None}) (set.of_list n.hash))] default (random.only (function (_ value) (not (or (n.even? value) (set.member? members value)))) random.nat)] (_.cover [/.of_list /.list] - (and (|> the_list /.of_list (/.list #.None) + (and (|> the_list /.of_list (/.list {.#None}) (\ (list.equivalence n.equivalence) = the_list)) - (|> the_array (/.list #.None) /.of_list + (|> the_array (/.list {.#None}) /.of_list (\ (/.equivalence n.equivalence) = the_array)) (exec (/.filter! n.even? the_array) (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!] @@ -207,18 +207,18 @@ (/.empty size))] (exec (/.copy! amount 0 the_array 0 copy) (\ (list.equivalence n.equivalence) = - (list.first amount (/.list #.None the_array)) - (/.list #.None copy)))))) + (list.first amount (/.list {.#None} the_array)) + (/.list {.#None} copy)))))) (_.cover [/.clone] (let [clone (/.clone the_array)] (and (not (same? the_array clone)) (\ (/.equivalence n.equivalence) = the_array clone)))) (let [the_array (/.clone the_array) - evens (|> the_array (/.list #.None) (list.only n.even?)) - odds (|> the_array (/.list #.None) (list.only n.odd?))] + evens (|> the_array (/.list {.#None}) (list.only n.even?)) + odds (|> the_array (/.list {.#None}) (list.only n.odd?))] (_.cover [/.filter!] (exec (/.filter! n.even? the_array) (and (n.= (list.size evens) (/.occupancy the_array)) (n.= (list.size odds) (/.vacancy the_array)) - (|> the_array (/.list #.None) (\ (list.equivalence n.equivalence) = evens)))))) + (|> the_array (/.list {.#None}) (\ (list.equivalence n.equivalence) = evens)))))) )))) diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index 2f8a58bfc..264f80fb9 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!))) @@ -189,10 +189,10 @@ (and (/.key? base non_key) (not (/.key? (/.lacks non_key base) non_key)))) (case (list.head (/.keys dict)) - #.None + {.#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,23 +209,23 @@ (_.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 + {.#None} false) can_upsert_old_key! (case (list.head (/.entries dict)) - #.None + {.#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 + {.#None} false))] (and can_upsert_new_key! can_upsert_old_key!))) diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index 004b8e608..75749c61d 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -75,20 +75,20 @@ (/.empty? (/.empty n.order))) (_.cover [/.min] (case [(/.min sample) (list.head sorted_values)] - [#.None #.None] + [{.#None} {.#None}] #1 - [{#.Some reference} {#.Some sample}] + [{.#Some reference} {.#Some sample}] (n.= reference sample) _ #0)) (_.cover [/.max] (case [(/.max sample) (list.last sorted_values)] - [#.None #.None] + [{.#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 b2411ce74..d924cb788 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -168,10 +168,10 @@ (_.cover [/.item] (/.every? (function (_ [index expected]) (case (/.item index sample) - {#.Some actual} + {.#Some actual} (n.= expected actual) - #.None + {.#None} false)) (/.enumeration sample))) )))) @@ -238,20 +238,20 @@ [($_ _.and (_.cover [<head>] (case [(<pre> sample) (<head> sample)] - [{#.Item expected _} {#.Some actual}] + [{.#Item expected _} {.#Some actual}] (n.= expected actual) - [#.End #.None] + [{.#End} {.#None}] true _ false)) (_.cover [<tail>] (case [(<pre> sample) (<tail> sample)] - [{#.Item _ expected} {#.Some actual}] + [{.#Item _ expected} {.#Some actual}] (/\= (<pre> expected) actual) - [#.End #.None] + [{.#End} {.#None}] true _ @@ -355,8 +355,8 @@ choose (: (-> Nat (Maybe Text)) (function (_ value) (if (n.even? value) - {#.Some (\ n.decimal encoded value)} - #.None)))] + {.#Some (\ n.decimal encoded value)} + {.#None})))] (do [! random.monad] [sample ..random] ($_ _.and @@ -366,10 +366,10 @@ (/\each (\ n.decimal encoded)) /.head) (/.one choose sample)] - [{#.Some expected} {#.Some actual}] + [{.#Some expected} {.#Some actual}] (text\= expected actual) - [#.None #.None] + [{.#None} {.#None}] true _ @@ -382,10 +382,10 @@ (/.all choose sample))) (_.cover [/.example] (case (/.example n.even? sample) - {#.Some found} + {.#Some found} (n.even? found) - #.None + {.#None} (not (/.any? n.even? sample)))) )))) @@ -419,8 +419,8 @@ (/\= (/.indices size) (/.iterations (function (_ index) (if (n.< size index) - {#.Some (++ index)} - #.None)) + {.#Some (++ index)} + {.#None})) 0))))) (_.cover [/.mixes] (/\= (/\each (function (_ index) diff --git a/stdlib/source/test/lux/data/collection/queue.lux b/stdlib/source/test/lux/data/collection/queue.lux index 795806329..45053e52b 100644 --- a/stdlib/source/test/lux/data/collection/queue.lux +++ b/stdlib/source/test/lux/data/collection/queue.lux @@ -60,10 +60,10 @@ 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] + [{.#End} {.#None}] true _ @@ -95,7 +95,7 @@ has_expected_order!))) (_.cover [/.next] (case members - {#.Item target expected} + {.#Item target expected} (let [popped (/.next sample) size_decreases! @@ -113,7 +113,7 @@ popped_member_is_not_identified! has_expected_order!)) - #.End + {.#End} (and (/.empty? sample) (/.empty? (/.next sample))))) )))) diff --git a/stdlib/source/test/lux/data/collection/queue/priority.lux b/stdlib/source/test/lux/data/collection/queue/priority.lux index 6ec5cb958..807ee4fd5 100644 --- a/stdlib/source/test/lux/data/collection/queue/priority.lux +++ b/stdlib/source/test/lux/data/collection/queue/priority.lux @@ -49,17 +49,17 @@ (/.empty? /.empty)) (_.cover [/.front] (case (/.front sample) - {#.Some first} + {.#Some first} (n.> 0 (/.size sample)) - #.None + {.#None} (/.empty? sample))) (_.cover [/.member?] (case (/.front sample) - {#.Some first} + {.#Some first} (/.member? n.equivalence sample first) - #.None + {.#None} (/.empty? sample))) (_.cover [/.end] (let [sample+ (/.end non_member_priority non_member sample)] diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux index 684619006..17e1d8192 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 89ad780c7..383c5c747 100644 --- a/stdlib/source/test/lux/data/collection/set/ordered.lux +++ b/stdlib/source/test/lux/data/collection/set/ordered.lux @@ -74,10 +74,10 @@ (~~ (template [<coverage> <comparison>] [(_.cover [<coverage>] (case (<coverage> setL) - {#.Some value} + {.#Some value} (|> setL /.list (list.every? (<comparison> value))) - #.None + {.#None} (/.empty? setL)))] [/.min n.>=] diff --git a/stdlib/source/test/lux/data/collection/stack.lux b/stdlib/source/test/lux/data/collection/stack.lux index 928dc475a..97e69923f 100644 --- a/stdlib/source/test/lux/data/collection/stack.lux +++ b/stdlib/source/test/lux/data/collection/stack.lux @@ -45,26 +45,26 @@ (/.empty? /.empty)) (_.cover [/.value] (case (/.value sample) - #.None + {.#None} (/.empty? sample) - {#.Some _} + {.#Some _} (not (/.empty? sample)))) (_.cover [/.next] (case (/.next sample) - #.None + {.#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)) - #.None + {.#None} false)) )))) diff --git a/stdlib/source/test/lux/data/collection/tree.lux b/stdlib/source/test/lux/data/collection/tree.lux index 0e18e595e..fef8c14f6 100644 --- a/stdlib/source/test/lux/data/collection/tree.lux +++ b/stdlib/source/test/lux/data/collection/tree.lux @@ -28,8 +28,8 @@ (in [(|> children (list\each product.left) (list\mix n.+ 1)) - [#/.value value - #/.children (list\each product.right children)]]))) + [/.#value value + /.#children (list\each product.right children)]]))) (def: .public test Test diff --git a/stdlib/source/test/lux/data/collection/tree/finger.lux b/stdlib/source/test/lux/data/collection/tree/finger.lux index c067ba36c..e00a0773b 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 0b6a33e05..f71def6fe 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -77,7 +77,7 @@ (\ bit.equivalence = (/.null? sample) (case sample - #/.Null true + {/.#Null} true _ false)))) (do random.monad [expected ..random] @@ -91,17 +91,17 @@ [keys (random.set text.hash 3 (random.ascii/alpha 1)) values (random.set frac.hash 3 random.safe_frac) .let [expected (list.zipped/2 (set.list keys) - (list\each (|>> #/.Number) (set.list values))) + (list\each (|>> {/.#Number}) (set.list values))) object (/.object expected)]] ($_ _.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!)))))) @@ -144,19 +144,19 @@ (try\each (\ <equivalence> = value)) (try.else false))))] - [/.Boolean /.boolean_field #/.Boolean random.bit bit.equivalence] - [/.Number /.number_field #/.Number random.safe_frac frac.equivalence] - [/.String /.string_field #/.String (random.ascii/alpha 1) text.equivalence] - [/.Array /.array_field #/.Array (random.row 3 ..random) (row.equivalence /.equivalence)] - [/.Object /.object_field #/.Object (random.dictionary text.hash 3 (random.ascii/alpha 1) ..random) (dictionary.equivalence /.equivalence)] + [/.Boolean /.boolean_field /.#Boolean random.bit bit.equivalence] + [/.Number /.number_field /.#Number random.safe_frac frac.equivalence] + [/.String /.string_field /.#String (random.ascii/alpha 1) text.equivalence] + [/.Array /.array_field /.#Array (random.row 3 ..random) (row.equivalence /.equivalence)] + [/.Object /.object_field /.#Object (random.dictionary text.hash 3 (random.ascii/alpha 1) ..random) (dictionary.equivalence /.equivalence)] )) (with_expansions [<boolean> (boolean) <number> (number) <string> (string) - <array_row> (row.row #/.Null - {#/.Boolean <boolean>} - {#/.Number <number>} - {#/.String <string>}) + <array_row> (row.row {/.#Null} + {/.#Boolean <boolean>} + {/.#Number <number>} + {/.#String <string>}) <key0> (string) <key1> (string) <key2> (string) @@ -165,20 +165,20 @@ <key5> (string) <key6> (string)] (_.cover [/.json] - (and (\= #/.Null (/.json #null)) + (and (\= {/.#Null} (/.json ())) (~~ (template [<tag> <value>] [(\= {<tag> <value>} (/.json <value>))] - [#/.Boolean <boolean>] - [#/.Number <number>] - [#/.String <string>] + [/.#Boolean <boolean>] + [/.#Number <number>] + [/.#String <string>] )) - (\= {#/.Array <array_row>} (/.json [#null <boolean> <number> <string>])) - (let [object (/.json {<key0> #null + (\= {/.#Array <array_row>} (/.json [() <boolean> <number> <string>])) + (let [object (/.json {<key0> () <key1> <boolean> <key2> <number> <key3> <string> - <key4> [#null <boolean> <number> <string>] + <key4> [() <boolean> <number> <string>] <key5> {<key6> <number>}})] (<| (try.else false) (do try.monad @@ -189,11 +189,11 @@ value4 (/.field <key4> object) 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)))))) + (in (and (\= {/.#Null} value0) + (\= {/.#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 835ce822e..1ed6821f6 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))) ))))) @@ -183,8 +183,8 @@ false))) (try.else false)))] - [/.Symbolic_Link #/.Symbolic_Link] - [/.Directory #/.Directory] + [/.Symbolic_Link /.#Symbolic_Link] + [/.Directory /.#Directory] )) (_.for [/.File /.Content /.content /.data] ($_ _.and @@ -196,10 +196,10 @@ tar (|> (row.row {<tag> [expected_path expected_moment /.none - [#/.user [#/.name /.anonymous - #/.id /.no_id] - #/.group [#/.name /.anonymous - #/.id /.no_id]] + [/.#user [/.#name /.anonymous + /.#id /.no_id] + /.#group [/.#name /.anonymous + /.#id /.no_id]] expected_content]}) (format.result /.writer) (<b>.result /.parser))] @@ -218,8 +218,8 @@ false))) (try.else false)))] - [/.Normal #/.Normal] - [/.Contiguous #/.Contiguous] + [/.Normal /.#Normal] + [/.Contiguous /.#Contiguous] )))))))) (def: random_mode @@ -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]] + [/.#user [/.#name /.anonymous + /.#id /.no_id] + /.#group [/.#name /.anonymous + /.#id /.no_id]] 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]] + [/.#user [/.#name /.anonymous + /.#id /.no_id] + /.#group [/.#name /.anonymous + /.#id /.no_id]] 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,39 +324,39 @@ ($_ _.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]] + [/.#user [/.#name expected + /.#id /.no_id] + /.#group [/.#name /.anonymous + /.#id /.no_id]] 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))) + (/.from_name (value@ [/.#user /.#name] actual_ownership))) (text\= (/.from_name /.anonymous) - (/.from_name (value@ [#/.group #/.name] actual_ownership)))) + (/.from_name (value@ [/.#group /.#name] actual_ownership)))) _ false))) @@ -365,26 +365,26 @@ (|> (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]] + [/.#user [/.#name /.anonymous + /.#id /.no_id] + /.#group [/.#name /.anonymous + /.#id /.no_id]] 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))) + (/.from_name (value@ [/.#user /.#name] actual_ownership))) (n.= (/.from_small /.no_id) - (/.from_small (value@ [#/.user #/.id] actual_ownership))) + (/.from_small (value@ [/.#user /.#id] actual_ownership))) (text\= (/.from_name /.anonymous) - (/.from_name (value@ [#/.group #/.name] actual_ownership))) + (/.from_name (value@ [/.#group /.#name] actual_ownership))) (n.= (/.from_small /.no_id) - (/.from_small (value@ [#/.group #/.id] actual_ownership)))) + (/.from_small (value@ [/.#group /.#id] actual_ownership)))) _ false))) @@ -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/name.lux b/stdlib/source/test/lux/data/name.lux index ca5201761..dd9171e99 100644 --- a/stdlib/source/test/lux/data/name.lux +++ b/stdlib/source/test/lux/data/name.lux @@ -65,10 +65,5 @@ (and (/\= [.prelude_module "yolo"] (.name_of .yolo)) (/\= ["test/lux/data/name" "yolo"] (.name_of ..yolo)) (/\= ["" "yolo"] (.name_of yolo)) - (/\= ["library/lux/test" "yolo"] (.name_of library/lux/test.yolo)))) - (_.test "Can obtain Name from tag." - (and (/\= [.prelude_module "yolo"] (.name_of #.yolo)) - (/\= ["test/lux/data/name" "yolo"] (.name_of #..yolo)) - (/\= ["" "yolo"] (.name_of #yolo)) - (/\= ["library/lux/test" "yolo"] (.name_of #library/lux/test.yolo))))))) + (/\= ["library/lux/test" "yolo"] (.name_of library/lux/test.yolo))))))) ))))) diff --git a/stdlib/source/test/lux/data/sum.lux b/stdlib/source/test/lux/data/sum.lux index bc1d9c70c..353c6f6c2 100644 --- a/stdlib/source/test/lux/data/sum.lux +++ b/stdlib/source/test/lux/data/sum.lux @@ -37,9 +37,9 @@ (_.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) diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index 305268a0b..b53d4b83b 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -152,15 +152,15 @@ 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) _ false) - #.None + {.#None} false))) (_.cover [/.space /.space?] (`` (and (~~ (template [<char>] @@ -210,11 +210,11 @@ (/.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)) - #.None + {.#None} false)) (_.cover [/.lower_cased] (let [effectiveness! @@ -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 6a658d960..edce881aa 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 ddd4d0afb..14883a7ff 100644 --- a/stdlib/source/test/lux/data/text/format.lux +++ b/stdlib/source/test/lux/data/text/format.lux @@ -167,10 +167,10 @@ [sample (random.maybe random.nat)] (_.cover [/.maybe] (case sample - #.None + {.#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 554a47eff..cb766f27b 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!_) @@ -274,11 +274,11 @@ (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} + {try.#Failure error} false)))]})) (def: .public test diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux index 80f78b281..d912904ec 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}] - [#.None] + [{.#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 d4979d44e..2d651be8e 100644 --- a/stdlib/source/test/lux/documentation.lux +++ b/stdlib/source/test/lux/documentation.lux @@ -22,11 +22,11 @@ (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 _} + {try.#Success _} false)))]})) (syntax: (description []) @@ -55,10 +55,10 @@ (case (`` (/.default (~~ (template.identifier [.._] [g!default])))) (^ (list definition)) (and (|> definition - (value@ #/.definition) + (value@ /.#definition) (text\= (template.text [g!default]))) (|> definition - (value@ #/.documentation) + (value@ /.#documentation) md.markdown (text\= "") not)) @@ -69,10 +69,10 @@ (case ..documentation: (^ (list documentation:)) (and (|> documentation: - (value@ #/.definition) + (value@ /.#definition) (text\= (template.text [/.documentation:]))) (|> documentation: - (value@ #/.documentation) + (value@ /.#documentation) md.markdown (text.contains? 'definition_description'))) @@ -98,7 +98,7 @@ (/.documentation super)) (case ..documentation: (^ (list documentation:)) - (text.contains? (md.markdown (value@ #/.documentation documentation:)) + (text.contains? (md.markdown (value@ /.#documentation documentation:)) (/.documentation super)) _ diff --git a/stdlib/source/test/lux/extension.lux b/stdlib/source/test/lux/extension.lux index 6076ca6ee..20b1a5357 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,30 +74,30 @@ (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 - (\ phase.monad each (|>> #jvm.Embedded row.row) + (\ phase.monad each (|>> {jvm.#Embedded} row.row) (phase archive pass_through))] (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 0e5933bbb..e94c61b39 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 @@ -127,7 +127,7 @@ (|> array /.length ..macro_error - (text.contains? (value@ #exception.label /.cannot_convert_to_jvm_type)))))))) + (text.contains? (value@ exception.#label /.cannot_convert_to_jvm_type)))))))) (def: for_miscellaneous 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] @@ -164,12 +164,12 @@ (_.cover [/.???] (and (|> (/.??? (/.null)) (: (Maybe java/lang/Object)) - (case> #.None #1 - {#.Some _} #0)) + (case> {.#None} #1 + {.#Some _} #0)) (|> (/.??? sample) (: (Maybe java/lang/Object)) - (case> {#.Some _} #1 - #.None #0)))) + (case> {.#Some _} #1 + {.#None} #0)))) (_.cover [/.!!!] (and (|> (/.??? (/.null)) /.!!! @@ -198,7 +198,7 @@ [/.Character /.char character character\=] )) (_.cover [/.cannot_cast_to_non_object] - (text.contains? (value@ #exception.label /.cannot_cast_to_non_object) + (text.contains? (value@ exception.#label /.cannot_cast_to_non_object) (macro_error (/.:as boolean (: /.Boolean boolean))))) (_.cover [/.:as] (|> string @@ -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,15 +586,15 @@ (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 [lux] - #try.Success))) + {try.#Success}))) (def: for_exception Test diff --git a/stdlib/source/test/lux/ffi.lua.lux b/stdlib/source/test/lux/ffi.lua.lux index 1e20f80ca..4b4bfcf1e 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 - #.None true)) + {.#Some _} true + {.#None} true)) ))))) diff --git a/stdlib/source/test/lux/ffi.old.lux b/stdlib/source/test/lux/ffi.old.lux index 7f53f7da4..9a1e0de54 100644 --- a/stdlib/source/test/lux/ffi.old.lux +++ b/stdlib/source/test/lux/ffi.old.lux @@ -179,10 +179,10 @@ (not (/.null? sample)))) (_.cover [/.???] (and (|> (: (Maybe java/lang/Object) (/.??? (/.null))) - (case> #.None #1 + (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 f8856abca..e2214512c 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)) ))) @@ -76,10 +76,10 @@ [language ..random_language 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})] + .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})] .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 2266d973a..db57938a1 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)))))) @@ -65,40 +65,40 @@ current_module (name.module (name_of .._))]] (in [seed identifier_prefix - [#.info [#.target "" - #.version "" - #.mode #.Build] - #.source [location.dummy 0 ""] - #.location location.dummy - #.current_module {#.Some current_module} - #.modules (list [macro_module - [#.module_hash 0 - #.module_aliases (list) - #.definitions (: (List [Text .Global]) + [.#info [.#target "" + .#version "" + .#mode {.#Build}] + .#source [location.dummy 0 ""] + .#location location.dummy + .#current_module {.#Some current_module} + .#modules (list [macro_module + [.#module_hash 0 + .#module_aliases (list) + .#definitions (: (List [Text .Global]) (list (!global /.log_single_expansion!) (!global /.log_expansion!) (!global /.log_full_expansion!))) - #.imports (list) - #.module_state #.Active]] + .#imports (list) + .#module_state {.#Active}]] [current_module - [#.module_hash 0 - #.module_aliases (list) - #.definitions (: (List [Text .Global]) + [.#module_hash 0 + .#module_aliases (list) + .#definitions (: (List [Text .Global]) (list (!global ..pow/2) (!global ..pow/4) (!global ..repeated))) - #.imports (list) - #.module_state #.Active]]) - #.scopes (list) - #.type_context [#.ex_counter 0 - #.var_counter 0 - #.var_bindings (list)] - #.expected #.None - #.seed seed - #.scope_type_vars (list) - #.extensions [] - #.eval (:as (-> Type Code (Meta Any)) []) - #.host []]]))) + .#imports (list) + .#module_state {.#Active}]]) + .#scopes (list) + .#type_context [.#ex_counter 0 + .#var_counter 0 + .#var_bindings (list)] + .#expected {.#None} + .#seed seed + .#scope_type_vars (list) + .#extensions [] + .#eval (:as (-> Type Code (Meta Any)) []) + .#host []]]))) (def: expander Test @@ -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 f14970009..96657f706 100644 --- a/stdlib/source/test/lux/macro/code.lux +++ b/stdlib/source/test/lux/macro/code.lux @@ -53,7 +53,6 @@ (random\each /.frac random.safe_frac) (random\each /.text ..random_text) (random\each /.identifier ..random_name) - (random\each /.tag ..random_name) (random\each /.form (..random_sequence random)) (random\each /.variant (..random_sequence random)) (random\each /.tuple (..random_sequence random)) @@ -67,11 +66,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])) @@ -94,8 +93,7 @@ (random\each /.rev random.rev) (random\each /.frac random.safe_frac) (random\each /.text ..random_text) - (random\each /.identifier ..random_name) - (random\each /.tag ..random_name)))] + (random\each /.identifier ..random_name)))] (in [sample sample])) (for_sequence /.form) (for_sequence /.variant) @@ -110,47 +108,45 @@ [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}] (<coverage> expected)))))] - [/.bit random.bit #.Bit] - [/.nat random.nat #.Nat] - [/.int random.int #.Int] - [/.rev random.rev #.Rev] - [/.frac random.safe_frac #.Frac] - [/.text ..random_text #.Text] - [/.tag ..random_name #.Tag] - [/.identifier ..random_name #.Identifier] - [/.form (..random_sequence ..random) #.Form] - [/.variant (..random_sequence ..random) #.Variant] - [/.tuple (..random_sequence ..random) #.Tuple])) + [/.bit random.bit .#Bit] + [/.nat random.nat .#Nat] + [/.int random.int .#Int] + [/.rev random.rev .#Rev] + [/.frac random.safe_frac .#Frac] + [/.text ..random_text .#Text] + [/.identifier ..random_name .#Identifier] + [/.form (..random_sequence ..random) .#Form] + [/.variant (..random_sequence ..random) .#Variant] + [/.tuple (..random_sequence ..random) .#Tuple])) (~~ (template [<coverage> <random> <tag>] [(do [! random.monad] [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]}] (<coverage> expected))) ))] - [/.local_tag ..random_text #.Tag] - [/.local_identifier ..random_text #.Identifier] + [/.local_identifier ..random_text .#Identifier] ))))) (def: .public test diff --git a/stdlib/source/test/lux/macro/local.lux b/stdlib/source/test/lux/macro/local.lux index b36094399..26e003577 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 @@ -52,9 +52,9 @@ [module short] (meta.normal name) _ (if pre_remove (let [remove_macro! (: (-> .Module .Module) - (revised@ #.definitions (plist.lacks short)))] + (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)] diff --git a/stdlib/source/test/lux/macro/syntax/check.lux b/stdlib/source/test/lux/macro/syntax/check.lux index de1e3fe56..0b315092e 100644 --- a/stdlib/source/test/lux/macro/syntax/check.lux +++ b/stdlib/source/test/lux/macro/syntax/check.lux @@ -38,11 +38,11 @@ [[type value] ..random] (_.cover [/.format /.parser] (case (<code>.result /.parser - (list (/.format [#/.type type - #/.value value]))) - {#try.Failure _} + (list (/.format [/.#type type + /.#value value]))) + {try.#Failure _} false - {#try.Success check} - (and (code\= type (value@ #/.type check)) - (code\= value (value@ #/.value 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 f14762ad6..f4dbee84b 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 b76f75cdb..d6881c287 100644 --- a/stdlib/source/test/lux/macro/syntax/definition.lux +++ b/stdlib/source/test/lux/macro/syntax/definition.lux @@ -34,23 +34,23 @@ )) (def: compiler - [#.info [#.target "FAKE" - #.version "0.0.0" - #.mode #.Build] - #.source [location.dummy 0 ""] - #.location location.dummy - #.current_module #.None - #.modules (list) - #.scopes (list) - #.type_context [#.ex_counter 0 - #.var_counter 0 - #.var_bindings (list)] - #.expected #.None - #.seed 0 - #.scope_type_vars (list) - #.extensions [] - #.eval (:as (-> Type Code (Meta Any)) []) - #.host []]) + [.#info [.#target "FAKE" + .#version "0.0.0" + .#mode {.#Build}] + .#source [location.dummy 0 ""] + .#location location.dummy + .#current_module {.#None} + .#modules (list) + .#scopes (list) + .#type_context [.#ex_counter 0 + .#var_counter 0 + .#var_bindings (list)] + .#expected {.#None} + .#seed 0 + .#scope_type_vars (list) + .#extensions [] + .#eval (:as (-> Type Code (Meta Any)) []) + .#host []]) (def: .public test Test @@ -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 ac95210a2..0dcc94f69 100644 --- a/stdlib/source/test/lux/macro/syntax/export.lux +++ b/stdlib/source/test/lux/macro/syntax/export.lux @@ -33,10 +33,10 @@ [[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 + {.#None} (list (code.nat expected_un_exported))) (<code>.result (/.parser <code>.nat)) (try\each (function (_ [actual_export_policy actual_un_exported]) diff --git a/stdlib/source/test/lux/macro/syntax/input.lux b/stdlib/source/test/lux/macro/syntax/input.lux index b822f1b94..9ac7d311b 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 74263e302..dd0a8ef06 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 @@ -44,9 +44,9 @@ [left random.nat mid random.nat right random.nat] - (with_expansions [<module> (as_is [.5 -4 +3 2 #1 #0 #c b "a"]) + (with_expansions [<module> (as_is [.5 -4 +3 2 #1 #0 c b "a"]) <module>' ".5-4+32#1#0cba" - <short> (as_is ["a" b #c #0 #1 2 +3 -4 .5]) + <short> (as_is ["a" b c #0 #1 2 +3 -4 .5]) <short>' "abc#0#12+3-4.5"] ($_ _.and (_.cover [/.spliced] @@ -69,14 +69,6 @@ [<module>' <short>'] true _ false) )) - (_.cover [/.tag] - (and (case (`` (name_of (~~ (/.tag <short>)))) - ["" <short>'] true - _ false) - (case (`` (name_of (~~ (/.tag <module> <short>)))) - [<module>' <short>'] true - _ false) - )) (_.cover [/.with_locals] (/.with_locals [var0 var1] (let [var0 left diff --git a/stdlib/source/test/lux/math/logic/fuzzy.lux b/stdlib/source/test/lux/math/logic/fuzzy.lux index d4887967e..65474ff58 100644 --- a/stdlib/source/test/lux/math/logic/fuzzy.lux +++ b/stdlib/source/test/lux/math/logic/fuzzy.lux @@ -93,10 +93,10 @@ (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)))) + {.#None})))) .let [bottom_set (/.gradient bottom middle_bottom) top_set (/.gradient middle_top top)]] @@ -177,10 +177,10 @@ (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))))] + {.#None}))))] ($_ _.and (_.cover [/.triangle] (let [reference (/.triangle bottom middle_bottom top) diff --git a/stdlib/source/test/lux/math/modular.lux b/stdlib/source/test/lux/math/modular.lux index bee6e09a5..f9d17a318 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,13 +96,13 @@ 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) (/.= one))) - #.None + {.#None} (not co_prime?)))) (_.cover [/.adapter] (<| (try.else false) @@ -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 d13cb6817..8d79b95b1 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 6614235b4..be315bbcc 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/complex.lux b/stdlib/source/test/lux/math/number/complex.lux index 9e002f43a..d8097380a 100644 --- a/stdlib/source/test/lux/math/number/complex.lux +++ b/stdlib/source/test/lux/math/number/complex.lux @@ -43,8 +43,8 @@ (def: angle (Random /.Complex) (\ random.monad each - (|>> (revised@ #/.real (f.% +1.0)) - (revised@ #/.imaginary (f.% +1.0))) + (|>> (revised@ /.#real (f.% +1.0)) + (revised@ /.#imaginary (f.% +1.0))) ..random)) (def: construction @@ -55,11 +55,11 @@ ($_ _.and (_.cover [/.complex] (and (let [r+i (/.complex real imaginary)] - (and (f.= real (value@ #/.real r+i)) - (f.= imaginary (value@ #/.imaginary r+i)))) + (and (f.= real (value@ /.#real r+i)) + (f.= imaginary (value@ /.#imaginary r+i)))) (let [r+i (/.complex real)] - (and (f.= real (value@ #/.real r+i)) - (f.= +0.0 (value@ #/.imaginary r+i)))))) + (and (f.= real (value@ /.#real r+i)) + (f.= +0.0 (value@ /.#imaginary r+i)))))) (_.cover [/.approximately?] (/.approximately? ..margin_of_error (/.complex real imaginary) @@ -135,18 +135,18 @@ (_.cover [/.+] (let [z (/.+ y x)] (and (/.= z - (/.complex (f.+ (value@ #/.real y) - (value@ #/.real x)) - (f.+ (value@ #/.imaginary y) - (value@ #/.imaginary x))))))) + (/.complex (f.+ (value@ /.#real y) + (value@ /.#real x)) + (f.+ (value@ /.#imaginary y) + (value@ /.#imaginary x))))))) (_.cover [/.-] (let [normal! (let [z (/.- y x)] (and (/.= z - (/.complex (f.- (value@ #/.real y) - (value@ #/.real x)) - (f.- (value@ #/.imaginary y) - (value@ #/.imaginary x)))))) + (/.complex (f.- (value@ /.#real y) + (value@ /.#real x)) + (f.- (value@ /.#imaginary y) + (value@ /.#imaginary x)))))) inverse! (and (|> x (/.+ y) (/.- y) (/.approximately? ..margin_of_error x)) @@ -161,8 +161,8 @@ (let [rem (/.% y x) quotient (|> x (/.- rem) (/./ y)) floored (|> quotient - (revised@ #/.real math.floor) - (revised@ #/.imaginary math.floor))] + (revised@ /.#real math.floor) + (revised@ /.#imaginary math.floor))] (/.approximately? +0.000000000001 x (|> quotient (/.* y) (/.+ rem))))) @@ -175,10 +175,10 @@ ($_ _.and (_.cover [/.conjugate] (let [cx (/.conjugate x)] - (and (f.= (value@ #/.real x) - (value@ #/.real cx)) - (f.= (f.opposite (value@ #/.imaginary x)) - (value@ #/.imaginary cx))))) + (and (f.= (value@ /.#real x) + (value@ /.#real cx)) + (f.= (f.opposite (value@ /.#imaginary x)) + (value@ /.#imaginary cx))))) (_.cover [/.reciprocal] (let [reciprocal! (|> x (/.* (/.reciprocal x)) (/.approximately? ..margin_of_error /.+one)) diff --git a/stdlib/source/test/lux/math/number/i64.lux b/stdlib/source/test/lux/math/number/i64.lux index a9bde8474..d935d0d9e 100644 --- a/stdlib/source/test/lux/math/number/i64.lux +++ b/stdlib/source/test/lux/math/number/i64.lux @@ -124,13 +124,13 @@ (do [! random.monad] [size (\ ! each (n.% /.width) random.nat)] (case (/.sub size) - #.None + {.#None} (_.cover [/.sub] (n.= 0 size)) - {#.Some sub} + {.#Some sub} (do [! random.monad] - [.let [limit (|> (-- (\ sub width)) + [.let [limit (|> (-- (\ sub bits)) /.mask .int ++)] diff --git a/stdlib/source/test/lux/math/number/ratio.lux b/stdlib/source/test/lux/math/number/ratio.lux index 2bced4d50..a9b18cdf8 100644 --- a/stdlib/source/test/lux/math/number/ratio.lux +++ b/stdlib/source/test/lux/math/number/ratio.lux @@ -79,11 +79,11 @@ with_denominator! (case (/.nat (/.ratio numerator denominator)) - {#.Some factor} + {.#Some factor} (and (n.= 0 (n.% denominator numerator)) (n.= numerator (n.* factor denominator))) - #.None + {.#None} (not (n.= 0 (n.% denominator numerator))))] (and only_numerator! denominator_1! @@ -111,8 +111,8 @@ (and (/.= right (|> div (/.* left) (/.+ rem))) (case (/.nat div) - {#.Some _} true - #.None false))))) + {.#Some _} true + {.#None} false))))) (do random.monad [left ..random right ..random] diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index 86af8bc90..d20c3d22c 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -49,39 +49,39 @@ expected_seed random.nat expected random.nat dummy (random.only (|>> (n.= expected) not) random.nat) - .let [expected_lux [#.info [#.target target - #.version version - #.mode #.Build] - #.source [location.dummy 0 source_code] - #.location location.dummy - #.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)}} - #.seed expected_seed - #.scope_type_vars (list) - #.extensions [] - #.eval (:as (-> Type Code (Meta Any)) []) - #.host []]]] + .let [expected_lux [.#info [.#target target + .#version version + .#mode {.#Build}] + .#source [location.dummy 0 source_code] + .#location location.dummy + .#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)}} + .#seed expected_seed + .#scope_type_vars (list) + .#extensions [] + .#eval (:as (-> Type Code (Meta Any)) []) + .#host []]]] ($_ _.and (_.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))))) ))) @@ -97,65 +97,65 @@ expected random.nat dummy (random.only (|>> (n.= expected) not) random.nat) expected_error (random.ascii/upper 1) - .let [expected_lux [#.info [#.target target - #.version version - #.mode #.Build] - #.source [location.dummy 0 source_code] - #.location location.dummy - #.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)}} - #.seed expected_seed - #.scope_type_vars (list) - #.extensions [] - #.eval (:as (-> Type Code (Meta Any)) []) - #.host []]]] + .let [expected_lux [.#info [.#target target + .#version version + .#mode {.#Build}] + .#source [location.dummy 0 source_code] + .#location location.dummy + .#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)}} + .#seed expected_seed + .#scope_type_vars (list) + .#extensions [] + .#eval (:as (-> Type Code (Meta Any)) []) + .#host []]]] ($_ _.and (_.cover [/.failure] (|> (/.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)))) )) ))) @@ -178,65 +178,65 @@ (not (or (text\= expected_current_module module) (text\= imported_module_name module)))) (random.ascii/upper 1)) - .let [imported_module [#.module_hash 0 - #.module_aliases (list) - #.definitions (list) - #.imports (list) - #.module_state #.Active] - expected_module [#.module_hash 0 - #.module_aliases (list) - #.definitions (list) - #.imports (list imported_module_name) - #.module_state #.Active] + .let [imported_module [.#module_hash 0 + .#module_aliases (list) + .#definitions (list) + .#imports (list) + .#module_state {.#Active}] + expected_module [.#module_hash 0 + .#module_aliases (list) + .#definitions (list) + .#imports (list imported_module_name) + .#module_state {.#Active}] expected_modules (list [expected_current_module expected_module] [imported_module_name imported_module]) - expected_lux [#.info [#.target target - #.version version - #.mode #.Build] - #.source [location.dummy 0 source_code] - #.location location.dummy - #.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)}} - #.seed expected_seed - #.scope_type_vars (list) - #.extensions [] - #.eval (:as (-> Type Code (Meta Any)) []) - #.host []]]] + expected_lux [.#info [.#target target + .#version version + .#mode {.#Build}] + .#source [location.dummy 0 source_code] + .#location location.dummy + .#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)}} + .#seed expected_seed + .#scope_type_vars (list) + .#extensions [] + .#eval (:as (-> Type Code (Meta Any)) []) + .#host []]]] (<| (_.for [.Module]) ($_ _.and (_.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,30 +284,30 @@ 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 dummy (random.only (|>> (n.= expected) not) random.nat) expected_location ..random_location - .let [type_context [#.ex_counter 0 - #.var_counter 0 - #.var_bindings (list)] - expected_lux [#.info [#.target target - #.version version - #.mode #.Build] - #.source [location.dummy 0 source_code] - #.location expected_location - #.current_module {#.Some expected_current_module} - #.modules (list) - #.scopes (list) - #.type_context type_context - #.expected {#.Some expected_type} - #.seed expected_seed - #.scope_type_vars (list) - #.extensions [] - #.eval (:as (-> Type Code (Meta Any)) []) - #.host []]]] + .let [type_context [.#ex_counter 0 + .#var_counter 0 + .#var_bindings (list)] + expected_lux [.#info [.#target target + .#version version + .#mode {.#Build}] + .#source [location.dummy 0 source_code] + .#location expected_location + .#current_module {.#Some expected_current_module} + .#modules (list) + .#scopes (list) + .#type_context type_context + .#expected {.#Some expected_type} + .#seed expected_seed + .#scope_type_vars (list) + .#extensions [] + .#eval (:as (-> Type Code (Meta Any)) []) + .#host []]]] ($_ _.and (_.cover [/.seed] (|> (do /.monad @@ -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,96 +355,96 @@ (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 + {.#None} (list)))] [current_globals macro_globals - [#.info [#.target "" - #.version "" - #.mode #.Build] - #.source [location.dummy 0 ""] - #.location location.dummy - #.current_module {#.Some expected_current_module} - #.modules (list [expected_current_module - [#.module_hash 0 - #.module_aliases (list) - #.definitions current_globals - #.imports (list) - #.module_state #.Active]] + [.#info [.#target "" + .#version "" + .#mode {.#Build}] + .#source [location.dummy 0 ""] + .#location location.dummy + .#current_module {.#Some expected_current_module} + .#modules (list [expected_current_module + [.#module_hash 0 + .#module_aliases (list) + .#definitions current_globals + .#imports (list) + .#module_state {.#Active}]] [expected_macro_module - [#.module_hash 0 - #.module_aliases (list) - #.definitions macro_globals - #.imports (list) - #.module_state #.Active]]) - #.scopes (list) - #.type_context [#.ex_counter 0 - #.var_counter 0 - #.var_bindings (list)] - #.expected #.None - #.seed 0 - #.scope_type_vars (list) - #.extensions [] - #.eval (:as (-> Type Code (Meta Any)) []) - #.host []]])))]] + [.#module_hash 0 + .#module_aliases (list) + .#definitions macro_globals + .#imports (list) + .#module_state {.#Active}]]) + .#scopes (list) + .#type_context [.#ex_counter 0 + .#var_counter 0 + .#var_bindings (list)] + .#expected {.#None} + .#seed 0 + .#scope_type_vars (list) + .#extensions [] + .#eval (:as (-> Type Code (Meta Any)) []) + .#host []]])))]] ($_ _.and (_.cover [.Global .Alias /.globals] (let [[current_globals macro_globals expected_lux] - (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,86 +470,86 @@ (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 + {.#None} (list)))] [current_globals macro_globals - [#.info [#.target "" - #.version "" - #.mode #.Build] - #.source [location.dummy 0 ""] - #.location location.dummy - #.current_module {#.Some expected_current_module} - #.modules (list [expected_current_module - [#.module_hash 0 - #.module_aliases (list) - #.definitions current_globals - #.imports (list) - #.module_state #.Active]] + [.#info [.#target "" + .#version "" + .#mode {.#Build}] + .#source [location.dummy 0 ""] + .#location location.dummy + .#current_module {.#Some expected_current_module} + .#modules (list [expected_current_module + [.#module_hash 0 + .#module_aliases (list) + .#definitions current_globals + .#imports (list) + .#module_state {.#Active}]] [expected_macro_module - [#.module_hash 0 - #.module_aliases (list) - #.definitions macro_globals - #.imports (list) - #.module_state #.Active]]) - #.scopes (list) - #.type_context [#.ex_counter 0 - #.var_counter 0 - #.var_bindings (list)] - #.expected #.None - #.seed 0 - #.scope_type_vars (list) - #.extensions [] - #.eval (:as (-> Type Code (Meta Any)) []) - #.host []]])))]] + [.#module_hash 0 + .#module_aliases (list) + .#definitions macro_globals + .#imports (list) + .#module_state {.#Active}]]) + .#scopes (list) + .#type_context [.#ex_counter 0 + .#var_counter 0 + .#var_bindings (list)] + .#expected {.#None} + .#seed 0 + .#scope_type_vars (list) + .#extensions [] + .#eval (:as (-> Type Code (Meta Any)) []) + .#host []]])))]] ($_ _.and (_.cover [/.export] (and (let [[current_globals macro_globals expected_lux] - (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)] + (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,52 +644,54 @@ (\ ! each set.list) (random.and (in head)))))] tags_0 random_labels - tags_1 (let [set/0 (set.of_list text.hash {#.Item tags_0})] - (random.only (|>> #.Item (list.any? (set.member? set/0))not) + 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 - [#.info [#.target "" - #.version "" - #.mode #.Build] - #.source [location.dummy 0 ""] - #.location location.dummy - #.current_module {#.Some current_module} - #.modules (list [current_module - [#.module_hash 0 - #.module_aliases (list) - #.definitions (list) - #.imports (list tag_module) - #.module_state #.Active]] + [.#info [.#target "" + .#version "" + .#mode {.#Build}] + .#source [location.dummy 0 ""] + .#location location.dummy + .#current_module {.#Some current_module} + .#modules (list [current_module + [.#module_hash 0 + .#module_aliases (list) + .#definitions (list) + .#imports (list tag_module) + .#module_state {.#Active}]] [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}]}] + [.#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}]}] ($_ 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} + [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]}]))))) - #.imports (list) - #.module_state #.Active]]) - #.scopes (list) - #.type_context [#.ex_counter 0 - #.var_counter 0 - #.var_bindings (list)] - #.expected #.None - #.seed 0 - #.scope_type_vars (list) - #.extensions [] - #.eval (:as (-> Type Code (Meta Any)) []) - #.host []])]] + [short {.#Slot [true type_1 {.#Item tags_1} index]}]))))) + .#imports (list) + .#module_state {.#Active}]]) + .#scopes (list) + .#type_context [.#ex_counter 0 + .#var_counter 0 + .#var_bindings (list)] + .#expected {.#None} + .#seed 0 + .#scope_type_vars (list) + .#extensions [] + .#eval (:as (-> Type Code (Meta Any)) []) + .#host []])]] ($_ _.and (_.cover [/.tag_lists] (let [equivalence (list.equivalence @@ -698,29 +700,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,63 +744,63 @@ (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)} + {.#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)} globals (: (List [Text .Global]) (list [name_4 - {#.Definition [false type_4 []]}])) - - scopes (list [#.name (list) - #.inner 0 - #.locals [#.counter 1 - #.mappings (list [name_3 [type_3 3]])] - #.captured [#.counter 0 - #.mappings (list)]] - [#.name (list) - #.inner 0 - #.locals [#.counter 2 - #.mappings (list [name_1 [type_1 1]] + {.#Definition [false type_4 []]}])) + + scopes (list [.#name (list) + .#inner 0 + .#locals [.#counter 1 + .#mappings (list [name_3 [type_3 3]])] + .#captured [.#counter 0 + .#mappings (list)]] + [.#name (list) + .#inner 0 + .#locals [.#counter 2 + .#mappings (list [name_1 [type_1 1]] [name_2 [type_2 2]])] - #.captured [#.counter 0 - #.mappings (list)]] - [#.name (list) - #.inner 0 - #.locals [#.counter 1 - #.mappings (list [name_0 [type_0 0]])] - #.captured [#.counter 0 - #.mappings (list)]])] + .#captured [.#counter 0 + .#mappings (list)]] + [.#name (list) + .#inner 0 + .#locals [.#counter 1 + .#mappings (list [name_0 [type_0 0]])] + .#captured [.#counter 0 + .#mappings (list)]])] .let [expected_lux (: Lux - [#.info [#.target "" - #.version "" - #.mode #.Build] - #.source [location.dummy 0 ""] - #.location location.dummy - #.current_module {#.Some current_module} - #.modules (list [current_module - [#.module_hash 0 - #.module_aliases (list) - #.definitions globals - #.imports (list) - #.module_state #.Active]]) - #.scopes scopes - #.type_context [#.ex_counter 0 - #.var_counter 0 - #.var_bindings (list)] - #.expected #.None - #.seed 0 - #.scope_type_vars (list) - #.extensions [] - #.eval (:as (-> Type Code (Meta Any)) []) - #.host []])]] + [.#info [.#target "" + .#version "" + .#mode {.#Build}] + .#source [location.dummy 0 ""] + .#location location.dummy + .#current_module {.#Some current_module} + .#modules (list [current_module + [.#module_hash 0 + .#module_aliases (list) + .#definitions globals + .#imports (list) + .#module_state {.#Active}]]) + .#scopes scopes + .#type_context [.#ex_counter 0 + .#var_counter 0 + .#var_bindings (list)] + .#expected {.#None} + .#seed 0 + .#scope_type_vars (list) + .#extensions [] + .#eval (:as (-> Type Code (Meta Any)) []) + .#host []])]] ($_ _.and (_.cover [.Scope /.locals] (let [equivalence (: (Equivalence (List (List [Text Type]))) @@ -866,7 +868,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,29 +885,29 @@ 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 dummy (random.only (|>> (n.= expected) not) random.nat) expected_location ..random_location - .let [expected_lux [#.info [#.target target - #.version version - #.mode #.Build] - #.source [expected_location 0 source_code] - #.location expected_location - #.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} - #.seed expected_seed - #.scope_type_vars (list) - #.extensions [] - #.eval (:as (-> Type Code (Meta Any)) []) - #.host []]]] + .let [expected_lux [.#info [.#target target + .#version version + .#mode {.#Build}] + .#source [expected_location 0 source_code] + .#location expected_location + .#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} + .#seed expected_seed + .#scope_type_vars (list) + .#extensions [] + .#eval (:as (-> Type Code (Meta Any)) []) + .#host []]]] ($_ _.and (_.for [/.functor] ($functor.spec ..injection (..comparison expected_lux) /.functor)) @@ -919,19 +921,19 @@ expected_error (random.ascii/upper 1)] (_.cover [/.lifted] (and (|> expected_error - #try.Failure + {try.#Failure} (: (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 - #try.Success + {try.#Success} (: (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 18bc932e8..b80b2aa90 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 d603b4d85..e048503ba 100644 --- a/stdlib/source/test/lux/static.lux +++ b/stdlib/source/test/lux/static.lux @@ -37,16 +37,16 @@ _ false)))] - [/.nat /.random_nat n.= n.+ #.Nat] - [/.int /.random_int i.= i.+ #.Int] - [/.rev /.random_rev r.= r.+ #.Rev] + [/.nat /.random_nat n.= n.+ .#Nat] + [/.int /.random_int i.= i.+ .#Int] + [/.rev /.random_rev r.= r.+ .#Rev] )) (_.cover [/.frac /.random_frac] (with_expansions [<left> (/.random_frac) <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 0d17df0ff..9c834c5dc 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -117,7 +117,7 @@ method_name (/type.method [(list) (list) ..$Object (list)]) (list) - {#.Some (do /.monad + {.#Some (do /.monad [_ bytecode] /.areturn)})) (row.row)) @@ -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) @@ -876,7 +876,7 @@ static_method (/type.method [(list) (list) ..$Long (list)]) (list) - {#.Some (do /.monad + {.#Some (do /.monad [_ (/.new $Self) _ /.dup _ (..$Long::literal part1) @@ -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,20 +1337,20 @@ primitive_method_name primitive_method_type (list) - {#.Some (do /.monad + {.#Some (do /.monad [_ ((value@ #literal primitive) expected)] 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 + {.#None} (in []) - {#.Some substitute} + {.#Some substitute} (substitute expected)) _ (value@ #wrap primitive)] /.areturn)})) @@ -1361,18 +1361,18 @@ 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 - (_.lifted "IRETURN" (primitive_return ..$Integer::primitive /.ireturn #.None (!::= java/lang/Integer "jvm ieq" "jvm int ="))) - (_.lifted "LRETURN" (primitive_return ..$Long::primitive /.lreturn #.None (!::= java/lang/Long "jvm leq" "jvm long ="))) - (_.lifted "FRETURN" (primitive_return ..$Float::primitive /.freturn #.None (!::= java/lang/Float "jvm feq" "jvm float ="))) - (_.lifted "DRETURN" (primitive_return ..$Double::primitive /.dreturn #.None (!::= java/lang/Double "jvm deq" "jvm double ="))) - (_.lifted "ARETURN" (primitive_return ..$String::primitive /.areturn #.None (function (_ expected actual) (text\= (:as Text expected) (:as Text actual))))) + (_.lifted "IRETURN" (primitive_return ..$Integer::primitive /.ireturn {.#None} (!::= java/lang/Integer "jvm ieq" "jvm int ="))) + (_.lifted "LRETURN" (primitive_return ..$Long::primitive /.lreturn {.#None} (!::= java/lang/Long "jvm leq" "jvm long ="))) + (_.lifted "FRETURN" (primitive_return ..$Float::primitive /.freturn {.#None} (!::= java/lang/Float "jvm feq" "jvm float ="))) + (_.lifted "DRETURN" (primitive_return ..$Double::primitive /.dreturn {.#None} (!::= java/lang/Double "jvm deq" "jvm double ="))) + (_.lifted "ARETURN" (primitive_return ..$String::primitive /.areturn {.#None} (function (_ expected actual) (text\= (:as Text expected) (:as Text actual))))) (_.lifted "RETURN" (primitive_return (: (Primitive java/lang/String) [#unboxed /type.void #boxed ..$String @@ -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,7 +1623,7 @@ name method::type (list) - {#.Some (do /.monad + {.#Some (do /.monad [_ (..$Long::literal value)] /.lreturn)}))) @@ -1633,7 +1633,7 @@ (list) (list) (list (/method.method ($_ /modifier\composite /method.public /method.abstract) - interface_method method::type (list) #.None)) + interface_method method::type (list) {.#None})) (row.row)) try.trusted (format.result /class.writer)) @@ -1646,14 +1646,14 @@ "<init>" constructor::type (list) - {#.Some (do /.monad + {.#Some (do /.monad [_ /.aload_0 _ (/.invokespecial ..$Object "<init>" constructor::type)] /.return)}) (method inherited_method part0) (method overriden_method fake_part2) (/method.method ($_ /modifier\composite /method.public /method.abstract) - abstract_method method::type (list) #.None)) + abstract_method method::type (list) {.#None})) (row.row)) try.trusted (format.result /class.writer)) @@ -1671,7 +1671,7 @@ "<init>" constructor::type (list) - {#.Some (do /.monad + {.#Some (do /.monad [_ /.aload_0 _ (/.invokespecial $Abstract "<init>" constructor::type)] /.return)}) @@ -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) @@ -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/test.lux b/stdlib/source/test/lux/test.lux index 60176aadc..d8dfd6e88 100644 --- a/stdlib/source/test/lux/test.lux +++ b/stdlib/source/test/lux/test.lux @@ -25,8 +25,8 @@ (-> Text Text Nat Nat [/.Tally Text] Bit) (and (text.contains? expected_message/0 message) (text.contains? expected_message/1 message) - (n.= successes (value@ #/.successes tally)) - (n.= failures (value@ #/.failures tally)))) + (n.= successes (value@ /.#successes tally)) + (n.= failures (value@ /.#failures tally)))) (def: assertion /.Test @@ -41,10 +41,10 @@ (/.cover' [/.assertion /.Tally] (and (text.ends_with? expected_message/0 success_message) (text.ends_with? expected_message/0 failure_message) - (and (n.= 1 (value@ #/.successes success_tally)) - (n.= 0 (value@ #/.failures success_tally))) - (and (n.= 0 (value@ #/.successes failure_tally)) - (n.= 1 (value@ #/.failures failure_tally))))))) + (and (n.= 1 (value@ /.#successes success_tally)) + (n.= 0 (value@ /.#failures success_tally))) + (and (n.= 0 (value@ /.#successes failure_tally)) + (n.= 1 (value@ /.#failures failure_tally))))))) (in (do async.monad [tt (/.and' (/.assertion expected_message/0 true) (/.assertion expected_message/1 true)) @@ -82,10 +82,10 @@ [[pre_tally pre_message] pre [post_tally post_message] post] (/.cover' [/.seed] - (and (and (n.= 1 (value@ #/.successes pre_tally)) - (n.= 0 (value@ #/.failures pre_tally))) - (and (n.= 1 (value@ #/.successes post_tally)) - (n.= 0 (value@ #/.failures post_tally))))))))) + (and (and (n.= 1 (value@ /.#successes pre_tally)) + (n.= 0 (value@ /.#failures pre_tally))) + (and (n.= 1 (value@ /.#successes post_tally)) + (n.= 0 (value@ /.#failures post_tally))))))))) (def: times /.Test @@ -95,9 +95,9 @@ (in (do async.monad [[tally error] times_assertion] (/.cover' [/.must_try_test_at_least_once] - (and (text.contains? (value@ #exception.label /.must_try_test_at_least_once) error) - (n.= 0 (value@ #/.successes tally)) - (n.= 1 (value@ #/.failures tally))))))) + (and (text.contains? (value@ exception.#label /.must_try_test_at_least_once) error) + (n.= 0 (value@ /.#successes tally)) + (n.= 1 (value@ /.#failures tally))))))) (do [! random.monad] [expected (\ ! each (|>> (n.% 10) ++) random.nat) .let [counter (: (Atom Nat) @@ -112,8 +112,8 @@ actual (async.future (atom.read! counter))] (/.cover' [/.times] (and (n.= expected actual) - (n.= 1 (value@ #/.successes tally)) - (n.= 0 (value@ #/.failures tally))))))) + (n.= 1 (value@ /.#successes tally)) + (n.= 0 (value@ /.#failures tally))))))) )) (def: in_parallel @@ -135,8 +135,8 @@ actual (async.future (atom.read! counter))] (/.cover' [/.in_parallel] (and (n.= expected actual) - (n.= expected (value@ #/.successes tally)) - (n.= 0 (value@ #/.failures tally))))))) + (n.= expected (value@ /.#successes tally)) + (n.= 0 (value@ /.#failures tally))))))) (do [! random.monad] [expected (\ ! each (|>> (n.% 10) ++) random.nat) .let [counter (: (Atom Nat) @@ -153,10 +153,10 @@ [[tally error] assertion actual (async.future (atom.read! counter))] (/.cover' [/.error_during_execution] - (let [correct_error! (text.contains? (value@ #exception.label /.error_during_execution) error) + (let [correct_error! (text.contains? (value@ exception.#label /.error_during_execution) error) no_complete_run! (n.= 0 actual) - no_successes! (n.= 0 (value@ #/.successes tally)) - ran_all_tests! (n.= expected (value@ #/.failures tally))] + no_successes! (n.= 0 (value@ /.#successes tally)) + ran_all_tests! (n.= expected (value@ /.#failures tally))] (and correct_error! no_complete_run! no_successes! @@ -176,10 +176,10 @@ [[not_covering _] not_covering [covering _] covering] (/.cover' [/.covering] - (and (and (set.empty? (value@ #/.expected_coverage not_covering)) - (set.empty? (value@ #/.actual_coverage not_covering))) - (and (not (set.empty? (value@ #/.expected_coverage covering))) - (set.empty? (value@ #/.actual_coverage covering)))))))) + (and (and (set.empty? (value@ /.#expected_coverage not_covering)) + (set.empty? (value@ /.#actual_coverage not_covering))) + (and (not (set.empty? (value@ /.#expected_coverage covering))) + (set.empty? (value@ /.#actual_coverage covering)))))))) (do random.monad [not_covering (/.covering .._ (/.test "" true)) covering (/.covering .._ (/.cover [..dummy_target] true))] @@ -187,10 +187,10 @@ [[not_covering _] not_covering [covering _] covering] (/.cover' [/.cover] - (and (and (not (set.empty? (value@ #/.expected_coverage not_covering))) - (not (set.member? (value@ #/.actual_coverage not_covering) (name_of ..dummy_target)))) - (and (not (set.empty? (value@ #/.expected_coverage covering))) - (set.member? (value@ #/.actual_coverage covering) (name_of ..dummy_target)))))))) + (and (and (not (set.empty? (value@ /.#expected_coverage not_covering))) + (not (set.member? (value@ /.#actual_coverage not_covering) (name_of ..dummy_target)))) + (and (not (set.empty? (value@ /.#expected_coverage covering))) + (set.member? (value@ /.#actual_coverage covering) (name_of ..dummy_target)))))))) (do random.monad [not_covering (/.covering .._ (/.test "" true)) covering (/.covering .._ (in (/.cover' [..dummy_target] true)))] @@ -198,10 +198,10 @@ [[not_covering _] not_covering [covering _] covering] (/.cover' [/.cover'] - (and (and (not (set.empty? (value@ #/.expected_coverage not_covering))) - (not (set.member? (value@ #/.actual_coverage not_covering) (name_of ..dummy_target)))) - (and (not (set.empty? (value@ #/.expected_coverage covering))) - (set.member? (value@ #/.actual_coverage covering) (name_of ..dummy_target)))))))) + (and (and (not (set.empty? (value@ /.#expected_coverage not_covering))) + (not (set.member? (value@ /.#actual_coverage not_covering) (name_of ..dummy_target)))) + (and (not (set.empty? (value@ /.#expected_coverage covering))) + (set.member? (value@ /.#actual_coverage covering) (name_of ..dummy_target)))))))) (do random.monad [not_covering (/.covering .._ (/.test "" true)) covering (/.covering .._ (/.for [..dummy_target] (/.test "" true)))] @@ -209,10 +209,10 @@ [[not_covering _] not_covering [covering _] covering] (/.cover' [/.for] - (and (and (not (set.empty? (value@ #/.expected_coverage not_covering))) - (not (set.member? (value@ #/.actual_coverage not_covering) (name_of ..dummy_target)))) - (and (not (set.empty? (value@ #/.expected_coverage covering))) - (set.member? (value@ #/.actual_coverage covering) (name_of ..dummy_target)))))))) + (and (and (not (set.empty? (value@ /.#expected_coverage not_covering))) + (not (set.member? (value@ /.#actual_coverage not_covering) (name_of ..dummy_target)))) + (and (not (set.empty? (value@ /.#expected_coverage covering))) + (set.member? (value@ /.#actual_coverage covering) (name_of ..dummy_target)))))))) )) (def: .public test @@ -239,10 +239,10 @@ (/.cover' [/.test] (and (text.ends_with? expected_message/0 success_message) (text.ends_with? expected_message/0 failure_message) - (and (n.= 1 (value@ #/.successes success_tally)) - (n.= 0 (value@ #/.failures success_tally))) - (and (n.= 0 (value@ #/.successes failure_tally)) - (n.= 1 (value@ #/.failures failure_tally)))))))) + (and (n.= 1 (value@ /.#successes success_tally)) + (n.= 0 (value@ /.#failures success_tally))) + (and (n.= 0 (value@ /.#successes failure_tally)) + (n.= 1 (value@ /.#failures failure_tally)))))))) (do ! [tt (/.and (/.test expected_message/0 true) (/.test expected_message/1 true)) @@ -273,18 +273,18 @@ (text.contains? expected_message/0 success_message)) (and (text.contains? expected_context failure_message) (text.contains? expected_message/0 failure_message)) - (and (n.= 1 (value@ #/.successes success_tally)) - (n.= 0 (value@ #/.failures success_tally))) - (and (n.= 0 (value@ #/.successes failure_tally)) - (n.= 1 (value@ #/.failures failure_tally)))))))) + (and (n.= 1 (value@ /.#successes success_tally)) + (n.= 0 (value@ /.#failures success_tally))) + (and (n.= 0 (value@ /.#successes failure_tally)) + (n.= 1 (value@ /.#failures failure_tally)))))))) (do ! [failure_assertion (/.failure expected_message/0)] (in (do async.monad [[failure_tally failure_message] failure_assertion] (/.cover' [/.failure] (and (text.contains? expected_message/0 failure_message) - (and (n.= 0 (value@ #/.successes failure_tally)) - (n.= 1 (value@ #/.failures failure_tally)))))))) + (and (n.= 0 (value@ /.#successes failure_tally)) + (n.= 1 (value@ /.#failures failure_tally)))))))) (do ! [success_assertion (/.lifted expected_message/0 (in true)) failure_assertion (/.lifted expected_message/0 (in false))] @@ -294,10 +294,10 @@ (/.cover' [/.lifted] (and (text.contains? expected_message/0 success_message) (text.contains? expected_message/0 failure_message) - (and (n.= 1 (value@ #/.successes success_tally)) - (n.= 0 (value@ #/.failures success_tally))) - (and (n.= 0 (value@ #/.successes failure_tally)) - (n.= 1 (value@ #/.failures failure_tally)))))))) + (and (n.= 1 (value@ /.#successes success_tally)) + (n.= 0 (value@ /.#failures success_tally))) + (and (n.= 0 (value@ /.#successes failure_tally)) + (n.= 1 (value@ /.#failures failure_tally)))))))) ..times ..in_parallel ..coverage diff --git a/stdlib/source/test/lux/time.lux b/stdlib/source/test/lux/time.lux index 32bb9d67c..2e2ce39c5 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 24d18c5b9..975131f1c 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 04d267d79..c6f953334 100644 --- a/stdlib/source/test/lux/time/day.lux +++ b/stdlib/source/test/lux/time/day.lux @@ -27,13 +27,13 @@ (def: .public random (Random /.Day) - (random.either (random.either (random.either (random\in #/.Sunday) - (random\in #/.Monday)) - (random.either (random\in #/.Tuesday) - (random\in #/.Wednesday))) - (random.either (random.either (random\in #/.Thursday) - (random\in #/.Friday)) - (random\in #/.Saturday)))) + (random.either (random.either (random.either (random\in {/.#Sunday}) + (random\in {/.#Monday})) + (random.either (random\in {/.#Tuesday}) + (random\in {/.#Wednesday}))) + (random.either (random.either (random\in {/.#Thursday}) + (random\in {/.#Friday})) + (random\in {/.#Saturday})))) (def: .public test Test @@ -41,8 +41,8 @@ (_.for [/.Day]) (do random.monad [expected ..random - invalid (random.only (predicate.or (n.< (/.number #/.Sunday)) - (n.> (/.number #/.Saturday))) + invalid (random.only (predicate.or (n.< (/.number {/.#Sunday})) + (n.> (/.number {/.#Saturday}))) random.nat)] ($_ _.and (_.for [/.equivalence] @@ -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,15 +73,15 @@ (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) uniques (set.size (set.of_list /.hash /.week))] - (and (n.= (/.number #/.Saturday) + (and (n.= (/.number {/.#Saturday}) all) (n.= all uniques)))) diff --git a/stdlib/source/test/lux/time/instant.lux b/stdlib/source/test/lux/time/instant.lux index 57050174e..aba4914bf 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 4db1303b3..354441828 100644 --- a/stdlib/source/test/lux/time/month.lux +++ b/stdlib/source/test/lux/time/month.lux @@ -29,7 +29,7 @@ (def: .public random (Random /.Month) - (let [december (/.number #/.December)] + (let [december (/.number {/.#December})] (|> random.nat (\ random.monad each (|>> (n.% december) ++)) (random.one (|>> /.by_number try.maybe))))) @@ -52,8 +52,8 @@ (do random.monad [expected ..random - invalid (random.only (predicate.or (n.< (/.number #/.January)) - (n.> (/.number #/.December))) + invalid (random.only (predicate.or (n.< (/.number {/.#January})) + (n.> (/.number {/.#December}))) random.nat)] ($_ _.and (_.cover [/.number /.by_number] @@ -64,15 +64,15 @@ (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) uniques (set.size (set.of_list /.hash /.year))] - (and (n.= (/.number #/.December) + (and (n.= (/.number {/.#December}) all) (n.= all uniques)))) @@ -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 1d949bf44..f2b12e776 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 481f8a73e..4e8a2c28b 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 @@ -41,22 +41,22 @@ (def: (exhaustive_weaving branchings) (-> (List (List Code)) (List (List Code))) (case branchings - #.End - #.End + {.#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>] @@ -65,34 +65,34 @@ (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))) - #.None + {.#None} (in (list (' _))))) (r\in (list (' _))))]) - ([#.Nat r.nat code.nat] - [#.Int r.int code.int] - [#.Rev r.rev code.rev] - [#.Frac r.frac code.frac] - [#.Text (r.unicode 5) code.text]) + ([.#Nat r.nat code.nat] + [.#Int r.int code.int] + [.#Rev r.rev code.rev] + [.#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,10 +163,10 @@ ////analysis.with_scope (do phase.monad [_ (//module.declare_tags variant_tags false - {#.Named [module_name variant_name] + {.#Named [module_name variant_name] (type.variant primitivesT)}) _ (//module.declare_tags record_tags false - {#.Named [module_name record_name] + {.#Named [module_name record_name] (type.tuple primitivesT)})]) (//module.with_module 0 module_name)))] exhaustive_patterns (exhaustive_branches true variantTC inputC) 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 73ef650e6..4236d6022 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 1ca30c317..c81b5a62a 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)) + (_.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,16 +99,16 @@ [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) _ false))))] - [Bit #////analysis.Bit r.bit code.bit] - [Nat #////analysis.Nat r.nat code.nat] - [Int #////analysis.Int r.int code.int] - [Rev #////analysis.Rev r.rev code.rev] - [Frac #////analysis.Frac r.frac code.frac] - [Text #////analysis.Text (r.unicode 5) code.text] + [Bit ////analysis.#Bit r.bit code.bit] + [Nat ////analysis.#Nat r.nat code.nat] + [Int ////analysis.#Int r.int code.int] + [Rev ////analysis.#Rev r.rev code.rev] + [Frac ////analysis.#Frac r.frac code.frac] + [Text ////analysis.#Text (r.unicode 5) code.text] )))))) 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 981b2604f..7fcc0f9e0 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 9d276e070..9d3665427 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> _ @@ -59,8 +59,8 @@ expected//lefts (if expected//right? (-- tag) tag) - actual//right? (value@ #////analysis.right? variant) - actual//lefts (value@ #////analysis.lefts variant)] + actual//right? (value@ ////analysis.#right? variant) + actual//lefts (value@ ////analysis.#lefts variant)] (and (n.= expected//lefts actual//lefts) (bit\= expected//right? @@ -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 166aa24f6..528cc4ca9 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 2c59172e6..9ef9354cf 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,14 +171,14 @@ [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))}}} - [[#analysis.when (analysis.pattern/bit test) - #analysis.then (analysis.nat then)] - (list [#analysis.when (analysis.pattern/bit (not test)) - #analysis.then (analysis.nat 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)) + analysis.#then (analysis.nat else)])]]))) (def: (random_five hash random_element) (All (_ a) (-> (Hash a) (Random a) (Random [a a a a a]))) @@ -197,17 +197,17 @@ (do [! random.monad] [[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)}}) - [[#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)] - [#analysis.when (<pattern> test/3) #analysis.then (<analysis> body/3)] - [#analysis.when (<pattern> test/4) #analysis.then (<analysis> body/4)])]])))] + (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)}}) + [[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)] + [analysis.#when (<pattern> test/3) analysis.#then (<analysis> body/3)] + [analysis.#when (<pattern> test/4) analysis.#then (<analysis> body/4)])]])))] [random_nat n.hash random.nat (|>> .i64 synthesis.path/i64) (|>> .i64 synthesis.i64) analysis.pattern/nat analysis.nat] [random_int int.hash random.int (|>> .i64 synthesis.path/i64) (|>> .i64 synthesis.i64) analysis.pattern/int analysis.int] @@ -235,19 +235,19 @@ [body/0 body/1 body/2 body/3 body/4] (random_five frac.hash random.frac) .let [path (: (-> Nat Bit Text Frac Path) (function (_ lefts right? value body) - ($_ #synthesis.Seq + ($_ {synthesis.#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 - #analysis.right? right? - #analysis.value (analysis.pattern/text value)]) - #analysis.then (analysis.frac body)]))]] - (in [($_ #synthesis.Alt + [analysis.#when (analysis.pattern/variant [analysis.#lefts lefts + analysis.#right? right? + analysis.#value (analysis.pattern/text value)]) + analysis.#then (analysis.frac body)]))]] + (in [($_ {synthesis.#Alt} (path lefts/0 false value/0 body/0) (path lefts/1 false value/1 body/1) (path lefts/2 false value/2 body/2) @@ -274,34 +274,34 @@ .let [path (: (-> Nat Bit Text Frac Path) (function (_ lefts right? value body) (if right? - ($_ #synthesis.Seq + ($_ {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.Seq + {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.#Pop} + {synthesis.#Then (synthesis.f64 body)})))) branch (: (-> Nat Bit Text Frac Branch) (function (_ lefts right? value body) - [#analysis.when (if right? + [analysis.#when (if right? (analysis.pattern/tuple (list\composite (list.repeated (++ lefts) (analysis.pattern/unit)) (list (analysis.pattern/text value)))) (analysis.pattern/tuple ($_ list\composite (list.repeated lefts (analysis.pattern/unit)) (list (analysis.pattern/text value) (analysis.pattern/unit))))) - #analysis.then (analysis.frac body)]))]] + 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 687fc849c..dcc48735f 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 @@ -39,24 +39,24 @@ (def: (n_function loop? arity body) (-> Bit Arity Synthesis Synthesis) (synthesis.function/abstraction - [#synthesis.environment (list) - #synthesis.arity arity - #synthesis.body (if loop? + [synthesis.#environment (list) + synthesis.#arity arity + synthesis.#body (if loop? (synthesis.loop/scope - [#synthesis.start 1 - #synthesis.inits (list) - #synthesis.iteration body]) + [synthesis.#start 1 + synthesis.#inits (list) + synthesis.#iteration body]) body)])) (def: (n_abstraction arity body) (-> Arity Analysis Analysis) (list\mix (function (_ arity_1 body) (case arity_1 - 0 {#analysis.Function (list) body} - _ {#analysis.Function ($_ list\composite - (list\each (|>> #variable.Foreign) + 0 {analysis.#Function (list) body} + _ {analysis.#Function ($_ list\composite + (list\each (|>> {variable.#Foreign}) (list.indices arity_1)) - (list {#variable.Local 1})) + (list {variable.#Local 1})) body})) body (list.reversed (list.indices arity)))) @@ -120,13 +120,13 @@ [loop? expected_value actual_value] (random_value false)] (in [loop? (synthesis.variant - [#analysis.lefts lefts - #analysis.right? right? - #analysis.value expected_value]) + [analysis.#lefts lefts + analysis.#right? right? + analysis.#value expected_value]) (analysis.variant - [#analysis.lefts lefts - #analysis.right? right? - #analysis.value actual_value])]))) + [analysis.#lefts lefts + analysis.#right? right? + analysis.#value actual_value])]))) (def: (random_tuple random_value output?) (-> Scenario Scenario) @@ -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 + {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])]}]))) + (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,9 +246,9 @@ (synthesis.branch/let [expected_input (++ arity) expected_output]) - {#analysis.Case actual_input - [[#analysis.when {#analysis.Bind 2} - #analysis.then actual_output] + {analysis.#Case actual_input + [[analysis.#when {analysis.#Bind 2} + analysis.#then actual_output] (list)]}]))) (def: (random_if random_value output?) @@ -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,16 +284,16 @@ [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 + {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.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?) @@ -309,7 +309,7 @@ [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))} (list\each (|>> product.right product.right) resets)])]))) @@ -324,9 +324,9 @@ true (list\each product.left resets)) (synthesis.loop/scope - [#synthesis.start (++ arity) - #synthesis.inits (list\each (|>> product.right product.left) resets) - #synthesis.iteration expected_output]) + [synthesis.#start (++ arity) + synthesis.#inits (list\each (|>> product.right product.left) resets) + synthesis.#iteration expected_output]) (analysis.apply [(..n_abstraction arity actual_output) (list\each (|>> product.right product.right) resets)])]))) @@ -345,18 +345,18 @@ [[loop?_output expected_output actual_output] (..random_nat output?) arity (|> random.nat (\ ! each (|>> (n.% 5) ++))) .let [environment ($_ list\composite - (list\each (|>> #variable.Foreign) + (list\each (|>> {variable.#Foreign}) (list.indices arity)) - (list {#variable.Local 1}))]] + (list {variable.#Local 1}))]] (in [true (synthesis.function/abstraction - [#synthesis.environment environment - #synthesis.arity 1 - #synthesis.body (synthesis.loop/scope - [#synthesis.start 1 - #synthesis.inits (list) - #synthesis.iteration expected_output])]) - {#analysis.Function environment + [synthesis.#environment environment + synthesis.#arity 1 + synthesis.#body (synthesis.loop/scope + [synthesis.#start 1 + synthesis.#inits (list) + synthesis.#iteration expected_output])]) + {analysis.#Function environment actual_output}]))) (def: (random_apply random_value output?) @@ -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 c27d08c14..f34540102 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) @@ -92,13 +92,13 @@ [next [valueE valueA]] (..reference offset arity next)] (in [next [(//.variant - [#analysis.lefts lefts - #analysis.right? right? - #analysis.value valueE]) + [analysis.#lefts lefts + analysis.#right? right? + analysis.#value valueE]) (//.variant - [#analysis.lefts lefts - #analysis.right? right? - #analysis.value valueA])]])) + [analysis.#lefts lefts + analysis.#right? right? + analysis.#value valueA])]])) (do [! random.monad] [[next [leftE leftA]] (..reference offset arity next) [next [rightE rightA]] (..reference offset arity next)] @@ -204,13 +204,13 @@ [next [iterationE iterationA]] (..reference offset arity next)] (in [next [(//.loop/scope - [#//.start (/.register_optimization offset next) - #//.inits (list firstE secondE) - #//.iteration iterationE]) + [//.#start (/.register_optimization offset next) + //.#inits (list firstE secondE) + //.#iteration iterationE]) (//.loop/scope - [#//.start next - #//.inits (list firstA secondA) - #//.iteration iterationA])]])) + [//.#start next + //.#inits (list firstA secondA) + //.#iteration iterationA])]])) )) (def: (function offset arity next) @@ -223,13 +223,13 @@ [next [bodyE bodyA]] (..primitive 0 arity next)] (in [next [(//.function/abstraction - [#//.environment (list firstE secondE) - #//.arity arity - #//.body bodyE]) + [//.#environment (list firstE secondE) + //.#arity arity + //.#body bodyE]) (//.function/abstraction - [#//.environment (list firstA secondA) - #//.arity arity - #//.body bodyA])]])) + [//.#environment (list firstA secondA) + //.#arity arity + //.#body bodyA])]])) )) (def: (control offset arity next) @@ -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) @@ -274,12 +274,12 @@ [_ [expected iteration]] (..scenario expected_offset arity 0)] (_.cover [/.Transform /.optimization /.register_optimization] (case (/.optimization true expected_offset expected_inits - [#//.environment (|> expected_offset + [//.#environment (|> expected_offset list.indices - (list\each (|>> #variable.Local))) - #//.arity arity - #//.body iteration]) - (^ {#.Some (//.loop/scope [actual_offset actual_inits + (list\each (|>> {variable.#Local}))) + //.#arity arity + //.#body iteration]) + (^ {.#Some (//.loop/scope [actual_offset actual_inits actual])}) (and (n.= expected_offset actual_offset) 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 79e26221b..107cae01d 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,24 +39,24 @@ 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>))] - [#////analysis.Unit (:as Text) #////synthesis.Text (|>)] - [#////analysis.Bit (|>) #////synthesis.Bit (|>)] - [#////analysis.Nat .i64 #////synthesis.I64 .i64] - [#////analysis.Int .i64 #////synthesis.I64 .i64] - [#////analysis.Rev .i64 #////synthesis.I64 .i64] - [#////analysis.Frac (|>) #////synthesis.F64 (|>)] - [#////analysis.Text (|>) #////synthesis.Text (|>)] + [////analysis.#Unit (:as Text) ////synthesis.#Text (|>)] + [////analysis.#Bit (|>) ////synthesis.#Bit (|>)] + [////analysis.#Nat .i64 ////synthesis.#I64 .i64] + [////analysis.#Int .i64 ////synthesis.#I64 .i64] + [////analysis.#Rev .i64 ////synthesis.#I64 .i64] + [////analysis.#Frac (|>) ////synthesis.#F64 (|>)] + [////analysis.#Text (|>) ////synthesis.#Text (|>)] )) (^ [(////analysis.tuple expected) @@ -72,25 +72,25 @@ (def: .public test Test - (<| (_.context (%.name (name_of #////synthesis.Primitive))) + (<| (_.context (%.name (name_of ////synthesis.#Primitive))) (`` ($_ _.and (~~ (template [<analysis> <synthesis> <generator>] [(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) _ false))))] - [#////analysis.Unit #////synthesis.Text (r\in ////synthesis.unit)] - [#////analysis.Bit #////synthesis.Bit r.bit] - [#////analysis.Nat #////synthesis.I64 (r\each .i64 r.nat)] - [#////analysis.Int #////synthesis.I64 (r\each .i64 r.int)] - [#////analysis.Rev #////synthesis.I64 (r\each .i64 r.rev)] - [#////analysis.Frac #////synthesis.F64 r.frac] - [#////analysis.Text #////synthesis.Text (r.unicode 5)])))))) + [////analysis.#Unit ////synthesis.#Text (r\in ////synthesis.unit)] + [////analysis.#Bit ////synthesis.#Bit r.bit] + [////analysis.#Nat ////synthesis.#I64 (r\each .i64 r.nat)] + [////analysis.#Int ////synthesis.#I64 (r\each .i64 r.int)] + [////analysis.#Rev ////synthesis.#I64 (r\each .i64 r.rev)] + [////analysis.#Frac ////synthesis.#F64 r.frac] + [////analysis.#Text ////synthesis.#Text (r.unicode 5)])))))) 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 c9334a880..898187283 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))) @@ -75,7 +75,7 @@ (def: .public test Test - (<| (_.context (%.name (name_of #////synthesis.Structure))) + (<| (_.context (%.name (name_of ////synthesis.#Structure))) ($_ _.and ..variant ..tuple 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 85fef40c0..dbfa2ea78 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,58 +160,58 @@ (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)] - [#synthesis.F64 random.frac] - [#synthesis.Text (random.unicode 1)] + [synthesis.#Bit random.bit] + [synthesis.#I64 (\ ! each .i64 random.nat)] + [synthesis.#F64 random.frac] + [synthesis.#Text (random.unicode 1)] ))) ($_ random.either (do [! random.monad] [side ..random_side [expected_next actual_next] (path_scenario scenario context)] - (in [{#synthesis.Seq {#synthesis.Access {#synthesis.Side side}} + (in [{synthesis.#Seq {synthesis.#Access {synthesis.#Side side}} expected_next} - {#synthesis.Seq {#synthesis.Access {#synthesis.Side side}} + {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}} + (in [{synthesis.#Seq {synthesis.#Access {synthesis.#Member member}} expected_next} - {#synthesis.Seq {#synthesis.Access {#synthesis.Member member}} + {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) @@ -274,8 +274,8 @@ (do [! random.monad] [_ (in []) .let [registers (dictionary.entries (value@ #necessary context)) - expected_environment (list\each (|>> product.left #variable.Local) registers) - actual_environment (list\each (|>> product.right #variable.Local) registers)] + expected_environment (list\each (|>> product.left {variable.#Local}) registers) + actual_environment (list\each (|>> product.right {variable.#Local}) registers)] [expected_body actual_body] (..primitive_scenario context)] (in [(synthesis.function/abstraction [expected_environment 1 expected_body]) (synthesis.function/abstraction [actual_environment 1 actual_body])]))) @@ -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 e9daa8e53..6683f7d8c 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 65bcf2d81..82798e7f3 100644 --- a/stdlib/source/test/lux/type.lux +++ b/stdlib/source/test/lux/type.lux @@ -52,17 +52,17 @@ (let [pairG (random.and recur recur) un_parameterized (: (Random Type) ($_ random.either - (random\each (|>> #.Primitive) (random.and ..short (random.list 0 recur))) - (random\each (|>> #.Primitive) (random.and ..short (random.list 1 recur))) - (random\each (|>> #.Primitive) (random.and ..short (random.list 2 recur))) - (random\each (|>> #.Sum) pairG) - (random\each (|>> #.Product) pairG) - (random\each (|>> #.Function) pairG) + (random\each (|>> {.#Primitive}) (random.and ..short (random.list 0 recur))) + (random\each (|>> {.#Primitive}) (random.and ..short (random.list 1 recur))) + (random\each (|>> {.#Primitive}) (random.and ..short (random.list 2 recur))) + (random\each (|>> {.#Sum}) pairG) + (random\each (|>> {.#Product}) pairG) + (random\each (|>> {.#Function}) pairG) ))] (case parameters 0 un_parameterized _ (|> random.nat - (random\each (|>> (n.% parameters) #.Parameter)) + (random\each (|>> (n.% parameters) {.#Parameter})) (random.either un_parameterized))))))) (def: .public (random parameters) @@ -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,16 +123,16 @@ (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)))) + (case> {.#None} #1 _ #0)))) (do [! random.monad] [size (|> random.nat (\ ! each (n.% 3))) members (monad.all ! (list.repeated size (..random 0))) 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)) _ @@ -196,7 +196,7 @@ )) (_.cover [/.:by_example] (let [example (: (Maybe Nat) - #.None)] + {.#None})] (/\= (.type (List Nat)) (/.:by_example [a] (Maybe a) diff --git a/stdlib/source/test/lux/type/abstract.lux b/stdlib/source/test/lux/type/abstract.lux index 479b08d68..3f0e20752 100644 --- a/stdlib/source/test/lux/type/abstract.lux +++ b/stdlib/source/test/lux/type/abstract.lux @@ -28,7 +28,7 @@ [(syntax: (<syntax> []) (do meta.monad [frame <meta>] - (in (list (code.text (value@ #/.name frame))))))] + (in (list (code.text (value@ /.#name frame))))))] [current /.current] [specific (/.specific (template.text [g!Foo]))] @@ -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 ed52a7d78..628b45d63 100644 --- a/stdlib/source/test/lux/type/check.lux +++ b/stdlib/source/test/lux/type/check.lux @@ -44,24 +44,24 @@ (function (_ recur) (let [pairG (random.and recur recur) quantifiedG (random.and (random\in (list)) (type' (++ num_vars))) - random_pair (random.either (random.either (random\each (|>> #.Sum) pairG) - (random\each (|>> #.Product) pairG)) - (random.either (random\each (|>> #.Function) pairG) - (random\each (|>> #.Apply) pairG))) - random_id (let [random_id (random.either (random\each (|>> #.Var) random.nat) - (random\each (|>> #.Ex) random.nat))] + random_pair (random.either (random.either (random\each (|>> {.#Sum}) pairG) + (random\each (|>> {.#Product}) pairG)) + (random.either (random\each (|>> {.#Function}) pairG) + (random\each (|>> {.#Apply}) pairG))) + random_id (let [random_id (random.either (random\each (|>> {.#Var}) random.nat) + (random\each (|>> {.#Ex}) random.nat))] (case num_vars 0 random_id - _ (random.either (random\each (|>> (n.% num_vars) (n.* 2) ++ #.Parameter) random.nat) + _ (random.either (random\each (|>> (n.% num_vars) (n.* 2) ++ {.#Parameter}) random.nat) random_id))) - random_quantified (random.either (random\each (|>> #.UnivQ) quantifiedG) - (random\each (|>> #.ExQ) quantifiedG))] + random_quantified (random.either (random\each (|>> {.#UnivQ}) quantifiedG) + (random\each (|>> {.#ExQ}) quantifiedG))] ($_ random.either - (random\each (|>> #.Primitive) (random.and ..short (random\in (list)))) + (random\each (|>> {.#Primitive}) (random.and ..short (random\in (list)))) random_pair random_id random_quantified - (random\each (|>> #.Named) (random.and ..name (type' 0))) + (random\each (|>> {.#Named}) (random.and ..name (type' 0))) ))))) (def: type @@ -71,19 +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))]) - ([#.Sum] [#.Product] [#.Function]) + ([.#Sum] [.#Product] [.#Function]) - {#.Named name type'} + {.#Named name type'} (valid_type? type') _ @@ -97,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) _ @@ -125,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 @@ -154,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) @@ -197,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 @@ -234,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) _ @@ -279,48 +279,48 @@ Test ($_ _.and (_.cover [/.fresh_context] - (and (n.= 0 (value@ #.var_counter /.fresh_context)) - (n.= 0 (value@ #.ex_counter /.fresh_context)) - (list.empty? (value@ #.var_bindings /.fresh_context)))) + (and (n.= 0 (value@ .#var_counter /.fresh_context)) + (n.= 0 (value@ .#ex_counter /.fresh_context)) + (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} - (and (n.= 1 (value@ #.var_counter actual)) - (n.= 0 (value@ #.ex_counter actual)) - (n.= 1 (list.size (value@ #.var_bindings 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} - (and (n.= 0 (value@ #.var_counter actual)) - (n.= 1 (value@ #.ex_counter actual)) - (n.= 0 (list.size (value@ #.var_bindings 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? @@ -332,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]))) @@ -350,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!))) @@ -373,8 +373,8 @@ (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)) @@ -389,28 +389,28 @@ (and invariant! covariant!)))] - [handles_products! #.Product] - [handles_sums! #.Sum] + [handles_products! .#Product] + [handles_sums! .#Sum] ) (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 _} + {try.#Failure _} false)]})) (def: (build_ring tail_size) @@ -578,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) @@ -638,14 +638,14 @@ (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 @@ -653,16 +653,16 @@ (in (function (_ holeT) {<tag> (leftT holeT) (rightT holeT)})))] - [#.Sum] - [#.Product] - [#.Function] - [#.Apply] + [.#Sum] + [.#Product] + [.#Function] + [.#Apply] )) (do [! random.monad] [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 @@ -670,10 +670,10 @@ body random.nat] (in (function (_ holeT) {<tag> (list (funcT holeT) (argT holeT)) - {#.Parameter body}})))] + {.#Parameter body}})))] - [#.UnivQ] - [#.ExQ] + [.#UnivQ] + [.#ExQ] )) ))))) @@ -705,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) @@ -727,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 @@ -744,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 @@ -759,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 @@ -774,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>] @@ -791,8 +791,8 @@ (in (not (or (/.subsumes? {<tag> id} example) (/.subsumes? example {<tag> id}))))))] - [#.Var for_subsumption|variable] - [#.Ex for_subsumption|existential] + [.#Var for_subsumption|variable] + [.#Ex for_subsumption|existential] ) (def: for_subsumption|quantification+application @@ -810,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 @@ -851,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 695caa566..0a85b8631 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/json.lux b/stdlib/source/test/lux/type/poly/json.lux index 0332e7d00..2be75b3e8 100644 --- a/stdlib/source/test/lux/type/poly/json.lux +++ b/stdlib/source/test/lux/type/poly/json.lux @@ -86,7 +86,7 @@ (def: qty (All (_ unit) (Random (unit.Qty unit))) - (\ random.monad each (debug.private unit.in) random.int)) + (\ random.monad each (debug.private unit.in') random.int)) (def: gen_record (Random Record) diff --git a/stdlib/source/test/lux/type/refinement.lux b/stdlib/source/test/lux/type/refinement.lux index bebde21e2..de7b0070b 100644 --- a/stdlib/source/test/lux/type/refinement.lux +++ b/stdlib/source/test/lux/type/refinement.lux @@ -39,10 +39,10 @@ ($_ _.and (_.cover [/.refiner] (case (/.refiner predicate raw) - {#.Some refined} + {.#Some refined} (predicate raw) - #.None + {.#None} (not (predicate raw)))) (_.cover [/.predicate] (|> (/.refiner predicate modulus) diff --git a/stdlib/source/test/lux/type/resource.lux b/stdlib/source/test/lux/type/resource.lux index f78fb8473..4f06802b3 100644 --- a/stdlib/source/test/lux/type/resource.lux +++ b/stdlib/source/test/lux/type/resource.lux @@ -160,12 +160,12 @@ (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} + {try.#Failure error} true)))]}))) (def: .public test diff --git a/stdlib/source/test/lux/type/unit.lux b/stdlib/source/test/lux/type/unit.lux index eaea8af2d..b7bcf40f3 100644 --- a/stdlib/source/test/lux/type/unit.lux +++ b/stdlib/source/test/lux/type/unit.lux @@ -172,8 +172,8 @@ )) (_.cover [/.*] (let [expected (i.* (\ /.meter out left) (\ /.meter out right)) - actual ((debug.private /.out) (: (/.Qty [/.Meter /.Meter]) - (/.* left right)))] + actual ((debug.private /.out') (: (/.Qty [/.Meter /.Meter]) + (/.* left right)))] (i.= expected actual))) (_.cover [/./] (|> right diff --git a/stdlib/source/test/lux/world/console.lux b/stdlib/source/test/lux/world/console.lux index eaf882016..f044be377 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 5ad722723..3e7b03015 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/input/keyboard.lux b/stdlib/source/test/lux/world/input/keyboard.lux index 7da4c9c34..192c406c1 100644 --- a/stdlib/source/test/lux/world/input/keyboard.lux +++ b/stdlib/source/test/lux/world/input/keyboard.lux @@ -160,8 +160,8 @@ [key ..random .let [sample (<function> key)]] (_.cover [<function>] - (and (bit\= <pressed?> (value@ #/.pressed? sample)) - (n.= key (value@ #/.input sample)))))] + (and (bit\= <pressed?> (value@ /.#pressed? sample)) + (n.= key (value@ /.#input sample)))))] [#0 /.release] [#1 /.press] diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux index 9a789fd70..5160aae60 100644 --- a/stdlib/source/test/lux/world/net/http/client.lux +++ b/stdlib/source/test/lux/world/net/http/client.lux @@ -47,30 +47,30 @@ (implementation (def: (request method url headers data) (io.io (let [value (case method - #//.Post on_post - #//.Get on_get - #//.Put on_put - #//.Patch on_patch - #//.Delete on_delete - #//.Head on_head - #//.Connect on_connect - #//.Options on_options - #//.Trace on_trace) + {//.#Post} on_post + {//.#Get} on_get + {//.#Put} on_put + {//.#Patch} on_patch + {//.#Delete} on_delete + {//.#Head} on_head + {//.#Connect} on_connect + {//.#Options} on_options + {//.#Trace} on_trace) data (|> value (\ nat.decimal encoded) (\ utf8.codec encoded))] - {#try.Success [//status.ok - [#//.headers headers - #//.body (function (_ ?wanted_bytes) - (io.io {#try.Success [(binary.size data) + {try.#Success [//status.ok + [//.#headers headers + //.#body (function (_ ?wanted_bytes) + (io.io {try.#Success [(binary.size data) data]}))]]})))))]] (`` ($_ _.and (~~ (template [<definition> <expected>] [(_.cover [<definition>] - (|> (<definition> "" //.empty #.None mock) + (|> (<definition> "" //.empty {.#None} mock) (do> try.monad [io.run!] - [product.right (value@ #//.body) (function.on #.None) io.run!] + [product.right (value@ //.#body) (function.on {.#None}) io.run!] [product.right (\ utf8.codec decoded)] [(\ nat.decimal decoded)] [(nat.= <expected>) in]) diff --git a/stdlib/source/test/lux/world/program.lux b/stdlib/source/test/lux/world/program.lux index c498a939b..e5909bcba 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 daa0a5e11..c79a2fa14 100644 --- a/stdlib/source/test/lux/world/shell.lux +++ b/stdlib/source/test/lux/world/shell.lux @@ -41,51 +41,51 @@ [echo (try.of_maybe (list.head arguments))] (in [dead? echo])))) - (def: (on_error dead?) + (def: (on_fail 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)) (implementation (def: (execute [environment working_directory command arguments]) (<| io.io - #try.Success + {try.#Success} (: (/.Process IO)) (implementation (def: (read _) - (io.io {#try.Success command})) - (def: (error _) - (io.io {#try.Success oops})) + (io.io {try.#Success command})) + (def: (fail _) + (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 (<| (_.covering /._) ($_ _.and (_.for [/.async /.mock /.Mock] - ($/.spec (/.async (/.mock (|>> ..mock #try.Success) + ($/.spec (/.async (/.mock (|>> ..mock {try.#Success}) false)))) (_.cover [/.error] (not (i.= /.normal /.error))) @@ -100,26 +100,26 @@ [verdict (do (try.with !) [process (\ shell execute [environment.empty "~" command (list)]) read (\ process read []) - error (\ process error []) + failure (\ process fail []) wrote! (do ! [write (\ process write input)] - (in {#try.Success (case write - {#try.Success _} + (in {try.#Success (case write + {try.#Success _} false - {#try.Failure 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} + {try.#Failure destroy} (text\= destruction destroy))})) await (\ process await [])] (in (and (text\= command read) - (text\= oops error) + (text\= oops failure) wrote! destroyed! (i.= exit await))))] |