From a4847190df926d35f7ece97da50a2a8b1462a24f Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 28 Jul 2022 02:44:45 -0400 Subject: Now statically resolving values from globals in pattern-matching. --- stdlib/source/library/lux.lux | 519 +++++++++++---------- stdlib/source/library/lux/abstract/interval.lux | 4 +- .../library/lux/control/concurrency/async.lux | 8 +- .../source/library/lux/control/concurrency/stm.lux | 4 +- stdlib/source/library/lux/control/maybe.lux | 4 +- stdlib/source/library/lux/data/collection/bits.lux | 4 +- .../library/lux/data/collection/dictionary.lux | 19 +- .../lux/data/collection/dictionary/ordered.lux | 22 +- stdlib/source/library/lux/data/collection/list.lux | 7 +- .../library/lux/data/collection/sequence.lux | 6 +- stdlib/source/library/lux/data/format/json.lux | 21 +- stdlib/source/library/lux/data/text/escape.lux | 10 +- stdlib/source/library/lux/data/text/regex.lux | 8 +- stdlib/source/library/lux/documentation.lux | 54 +-- stdlib/source/library/lux/ffi.jvm.lux | 8 +- stdlib/source/library/lux/ffi.old.lux | 15 +- stdlib/source/library/lux/ffi/export.rb.lux | 4 +- stdlib/source/library/lux/math/number.lux | 4 +- stdlib/source/library/lux/math/number/frac.lux | 6 +- stdlib/source/library/lux/math/number/int.lux | 8 +- stdlib/source/library/lux/math/number/nat.lux | 4 +- stdlib/source/library/lux/meta.lux | 15 +- .../compiler/language/lux/analysis/coverage.lux | 16 +- .../meta/compiler/language/lux/analysis/module.lux | 21 +- .../language/lux/phase/extension/analysis/jvm.lux | 18 +- .../lux/phase/extension/declaration/jvm.lux | 26 +- .../lux/phase/extension/declaration/lux.lux | 6 +- .../lux/phase/extension/generation/jvm/host.lux | 4 +- .../generation/jvm/function/field/constant.lux | 2 +- .../generation/jvm/function/field/variable.lux | 2 +- .../phase/generation/jvm/function/method/apply.lux | 2 +- .../jvm/function/method/implementation.lux | 2 +- .../phase/generation/jvm/function/method/init.lux | 2 +- .../phase/generation/jvm/function/method/new.lux | 2 +- .../phase/generation/jvm/function/method/reset.lux | 2 +- .../language/lux/phase/generation/jvm/host.lux | 4 +- .../language/lux/phase/generation/jvm/program.lux | 2 +- .../language/lux/phase/generation/jvm/runtime.lux | 24 +- .../language/lux/phase/generation/reference.lux | 4 +- .../compiler/language/lux/phase/synthesis/case.lux | 20 +- .../lux/meta/compiler/reference/variable.lux | 2 +- stdlib/source/library/lux/meta/macro/expansion.lux | 4 +- stdlib/source/library/lux/meta/macro/pattern.lux | 8 +- .../library/lux/meta/target/jvm/reflection.lux | 2 +- stdlib/source/library/lux/meta/type.lux | 12 +- stdlib/source/library/lux/meta/type/implicit.lux | 2 +- stdlib/source/library/lux/world/time/day.lux | 20 +- 47 files changed, 501 insertions(+), 462 deletions(-) (limited to 'stdlib/source/library') diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 6fb5b2a9f..16fb17d92 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -851,21 +851,21 @@ (macro (_ tokens) (meta#in {#End}))) -(def' .private $' +(def' .private $ Macro (macro (_ tokens) ({{#Item x {#End}} (meta#in tokens) {#Item x {#Item y xs}} - (meta#in {#Item (form$ {#Item (symbol$ [..prelude "$'"]) + (meta#in {#Item (form$ {#Item (symbol$ [..prelude "$"]) {#Item (variant$ {#Item (symbol$ [..prelude "#Apply"]) {#Item y {#Item x {#End}}}}) xs}}) {#End}}) _ - (failure "Wrong syntax for $'")} + (failure "Wrong syntax for $")} tokens))) (def' .private (list#mix f init xs) @@ -874,7 +874,7 @@ {#Function {#Parameter 3} {#Parameter 3}}} {#Function {#Parameter 3} - {#Function ($' List {#Parameter 1}) + {#Function ($ List {#Parameter 1}) {#Parameter 3}}}}}} ({{#End} init @@ -885,9 +885,9 @@ (def' .private (list#reversed list) {#UnivQ {#End} - {#Function ($' List {#Parameter 1}) ($' List {#Parameter 1})}} + {#Function ($ List {#Parameter 1}) ($ List {#Parameter 1})}} (list#mix ("lux type check" {#UnivQ {#End} - {#Function {#Parameter 1} {#Function ($' List {#Parameter 1}) ($' List {#Parameter 1})}}} + {#Function {#Parameter 1} {#Function ($ List {#Parameter 1}) ($ List {#Parameter 1})}}} (function'' [head tail] {#Item head tail})) {#End} list)) @@ -896,18 +896,18 @@ {#UnivQ {#End} {#UnivQ {#End} {#Function {#Function {#Parameter 3} {#Parameter 1}} - {#Function ($' List {#Parameter 3}) - ($' List {#Parameter 1})}}}} + {#Function ($ List {#Parameter 3}) + ($ List {#Parameter 1})}}}} (list#mix (function'' [head tail] {#Item (f head) tail}) {#End} (list#reversed xs))) (def' .private Replacement_Environment Type - ($' List {#Product Text Code})) + ($ List {#Product Text Code})) (def' .private (replacement_environment xs ys) - {#Function ($' List Text) {#Function ($' List Code) Replacement_Environment}} + {#Function ($ List Text) {#Function ($ List Code) Replacement_Environment}} ({[{#Item x xs'} {#Item y ys'}] {#Item [x y] (replacement_environment xs' ys')} @@ -920,7 +920,7 @@ ("lux text =" reference sample)) (def' .private (replacement for environment) - {#Function Text {#Function Replacement_Environment ($' Maybe Code)}} + {#Function Text {#Function Replacement_Environment ($ Maybe Code)}} ({{#End} {#None} @@ -962,7 +962,7 @@ (def' .private (list#size list) {#UnivQ {#End} - {#Function ($' List {#Parameter 1}) Nat}} + {#Function ($ List {#Parameter 1}) Nat}} (list#mix (function'' [_ acc] ("lux i64 +" 1 acc)) 0 list)) (def' .private (let$ binding value body) @@ -1276,7 +1276,7 @@ ..Tuple) (def' .private (pairs xs) - (All (_ a) (-> ($' List a) ($' Maybe ($' List (Tuple a a))))) + (All (_ a) (-> ($ List a) ($ Maybe ($ List (Tuple a a))))) ({{#Item x {#Item y xs'}} ({{#Some tail} {#Some {#Item [x y] tail}} @@ -1316,7 +1316,7 @@ (def' .private (any? p xs) (All (_ a) - (-> (-> a Bit) ($' List a) Bit)) + (-> (-> a Bit) ($ List a) Bit)) ({{#End} #0 @@ -1333,7 +1333,7 @@ content)))) (def' .private (untemplated_list tokens) - (-> ($' List Code) Code) + (-> ($ List Code) Code) ({{#End} |#End| @@ -1342,7 +1342,7 @@ tokens)) (def' .private (list#composite xs ys) - (All (_ a) (-> ($' List a) ($' List a) ($' List a))) + (All (_ a) (-> ($ List a) ($ List a) ($ List a))) (list#mix (function' [head tail] {#Item head tail}) ys (list#reversed xs))) @@ -1404,16 +1404,16 @@ {#Named [..prelude "Monad"] (All (_ !) (Tuple (All (_ a) - (-> a ($' ! a))) + (-> a ($ ! a))) (All (_ a b) - (-> (-> a ($' ! b)) - ($' ! a) - ($' ! b)))))} + (-> (-> a ($ ! b)) + ($ ! a) + ($ ! b)))))} ["#in" "#then"] #0) (def' .private maybe#monad - ($' Monad Maybe) + ($ Monad Maybe) [#in (function' [x] {#Some x}) @@ -1424,7 +1424,7 @@ ma))]) (def' .private meta#monad - ($' Monad Meta) + ($ Monad Meta) [#in (function' [x] (function' [state] @@ -1482,10 +1482,10 @@ (def' .private (monad#each m f xs) (All (_ m a b) - (-> ($' Monad m) - (-> a ($' m b)) - ($' List a) - ($' m ($' List b)))) + (-> ($ Monad m) + (-> a ($ m b)) + ($ List a) + ($ m ($ List b)))) (let' [[..#in in ..#then _] m] ({{#End} (in {#End}) @@ -1499,11 +1499,11 @@ (def' .private (monad#mix m f y xs) (All (_ m a b) - (-> ($' Monad m) - (-> a b ($' m b)) + (-> ($ Monad m) + (-> a b ($ m b)) b - ($' List a) - ($' m b))) + ($ List a) + ($ m b))) (let' [[..#in in ..#then _] m] ({{#End} (in y) @@ -1528,11 +1528,11 @@ (def' .private Property_List Type - (All (_ a) ($' List (Tuple Text a)))) + (All (_ a) ($ List (Tuple Text a)))) (def' .private (property#value k property_list) (All (_ a) - (-> Text ($' Property_List a) ($' Maybe a))) + (-> Text ($ Property_List a) ($ Maybe a))) ({{#Item [[k' v] property_list']} (if (text#= k k') {#Some v} @@ -1544,7 +1544,7 @@ (def' .private (property#with k v property_list) (All (_ a) - (-> Text a ($' Property_List a) ($' Property_List a))) + (-> Text a ($ Property_List a) ($ Property_List a))) ({{#Item [k' v'] property_list'} (if (text#= k k') (list#partial [k v] property_list') @@ -1555,7 +1555,7 @@ property_list)) (def' .private (global_symbol full_name state) - (-> Symbol ($' Meta Symbol)) + (-> Symbol ($ Meta Symbol)) (let' [[module name] full_name [..#info info ..#source source ..#current_module _ ..#modules modules ..#scopes scopes ..#type_context types ..#host host @@ -1618,7 +1618,7 @@ (def' .private (list#one f xs) (All (_ a b) - (-> (-> a ($' Maybe b)) ($' List a) ($' Maybe b))) + (-> (-> a ($ Maybe b)) ($ List a) ($ Maybe b))) ({{#End} {#None} @@ -1632,20 +1632,20 @@ xs)) (def' .private (in_env name state) - (-> Text Lux ($' Maybe Type)) + (-> Text Lux ($ Maybe Type)) (let' [[..#info info ..#source source ..#current_module _ ..#modules modules ..#scopes scopes ..#type_context types ..#host host ..#seed seed ..#expected expected ..#location location ..#extensions extensions ..#scope_type_vars scope_type_vars ..#eval _eval] state] (list#one ("lux type check" - (-> Scope ($' Maybe Type)) + (-> Scope ($ Maybe Type)) (function' [env] (let' [[..#name _ ..#inner _ ..#locals [..#counter _ ..#mappings locals] ..#captured _] env] (list#one ("lux type check" - (-> (Tuple Text (Tuple Type Any)) ($' Maybe Type)) + (-> (Tuple Text (Tuple Type Any)) ($ Maybe Type)) (function' [it] (let' [[bname [type _]] it] (if (text#= name bname) @@ -1655,7 +1655,7 @@ scopes))) (def' .private (available? expected_module current_module exported?) - (-> Text ($' Maybe Text) Bit Bit) + (-> Text ($ Maybe Text) Bit Bit) (if exported? #1 ({{.#None} @@ -1666,7 +1666,7 @@ current_module))) (def' .private (definition_value name state) - (-> Symbol ($' Meta (Tuple Type Any))) + (-> Symbol ($ Meta (Tuple Type Any))) (let' [[expected_module expected_short] name [..#info info ..#source source @@ -1716,7 +1716,7 @@ (property#value expected_module modules)))) (def' .private (global_value global lux) - (-> Symbol ($' Meta ($' Maybe (Tuple Type Any)))) + (-> Symbol ($ Meta ($ Maybe (Tuple Type Any)))) (let' [[module short] global] ({{#Right [lux' type,value]} {#Right [lux' {#Some type,value}]} @@ -1750,12 +1750,12 @@ (def' .private (every? ?) (All (_ a) - (-> (-> a Bit) ($' List a) Bit)) + (-> (-> a Bit) ($ List a) Bit)) (list#mix (function' [_2 _1] (if _1 (? _2) #0)) #1)) (def' .private (zipped_2 xs ys) (All (_ a b) - (-> ($' List a) ($' List b) ($' List (Tuple a b)))) + (-> ($ List a) ($ List b) ($ List (Tuple a b)))) ({{#Item x xs'} ({{#Item y ys'} (list#partial [x y] (zipped_2 xs' ys')) @@ -1830,7 +1830,7 @@ [left right])) (def' .private (one_expansion it) - (-> ($' Meta ($' List Code)) ($' Meta Code)) + (-> ($ Meta ($ List Code)) ($ Meta Code)) (do meta#monad [it it] ({{#Item it {#End}} @@ -1841,7 +1841,7 @@ it))) (def' .private (current_module_name state) - ($' Meta Text) + ($ Meta Text) ({[..#info info ..#source source ..#current_module current_module ..#modules modules ..#scopes scopes ..#type_context types ..#host host ..#seed seed ..#expected expected ..#location location ..#extensions extensions @@ -1855,7 +1855,7 @@ state)) (def' .private (normal name) - (-> Symbol ($' Meta Symbol)) + (-> Symbol ($ Meta Symbol)) ({["" name] (do meta#monad [module_name ..current_module_name] @@ -1866,11 +1866,11 @@ name)) (def' .private (untemplated_composite tag @composite untemplated replace? subst elements) - (-> Text Location (-> Bit Text Code ($' Meta Code)) Bit Text ($' List Code) - ($' Meta Code)) + (-> Text Location (-> Bit Text Code ($ Meta Code)) Bit Text ($ List Code) + ($ Meta Code)) (do meta#monad [.let' [cons ("lux type check" - (-> Code Code ($' Meta Code)) + (-> Code Code ($ Meta Code)) (function' [head tail] (do meta#monad [head (untemplated replace? subst head)] @@ -1908,22 +1908,22 @@ (in [@composite output']))) (def' .private untemplated_form - (-> Location (-> Bit Text Code ($' Meta Code)) Bit Text ($' List Code) - ($' Meta Code)) + (-> Location (-> Bit Text Code ($ Meta Code)) Bit Text ($ List Code) + ($ Meta Code)) (untemplated_composite "#Form")) (def' .private untemplated_variant - (-> Location (-> Bit Text Code ($' Meta Code)) Bit Text ($' List Code) - ($' Meta Code)) + (-> Location (-> Bit Text Code ($ Meta Code)) Bit Text ($ List Code) + ($ Meta Code)) (untemplated_composite "#Variant")) (def' .private untemplated_tuple - (-> Location (-> Bit Text Code ($' Meta Code)) Bit Text ($' List Code) - ($' Meta Code)) + (-> Location (-> Bit Text Code ($ Meta Code)) Bit Text ($ List Code) + ($ Meta Code)) (untemplated_composite "#Tuple")) (def' .private (untemplated replace? subst token) - (-> Bit Text Code ($' Meta Code)) + (-> Bit Text Code ($ Meta Code)) ({[_ [@token {#Bit value}]] (meta#in (with_location ..dummy_location (variant$ (list (symbol$ [..prelude "#Bit"]) (bit$ value))))) @@ -2153,7 +2153,7 @@ (function' [x] (f (g x)))) (def' .private (symbol_name x) - (-> Code ($' Maybe Symbol)) + (-> Code ($ Maybe Symbol)) ({[_ {#Symbol sname}] {#Some sname} @@ -2162,7 +2162,7 @@ x)) (def' .private (symbol_short x) - (-> Code ($' Maybe Text)) + (-> Code ($ Maybe Text)) ({[_ {#Symbol "" sname}] {#Some sname} @@ -2171,7 +2171,7 @@ x)) (def' .private (tuple_list tuple) - (-> Code ($' Maybe ($' List Code))) + (-> Code ($ Maybe ($ List Code))) ({[_ {#Tuple members}] {#Some members} @@ -2203,7 +2203,7 @@ template)) (def' .private (high_bits value) - (-> ($' I64 Any) I64) + (-> ($ I64 Any) I64) ("lux i64 right-shift" 32 value)) (def' .private low_mask @@ -2211,7 +2211,7 @@ (|> 1 ("lux i64 left-shift" 32) ("lux i64 -" 1))) (def' .private (low_bits value) - (-> ($' I64 Any) I64) + (-> ($ I64 Any) I64) ("lux i64 and" low_mask value)) (def' .private (n/< reference sample) @@ -2228,7 +2228,7 @@ (def' .private (list#conjoint xs) (All (_ a) - (-> ($' List ($' List a)) ($' List a))) + (-> ($ List ($ List a)) ($ List a))) (list#mix list#composite {#End} (list#reversed xs))) (def' .public symbol @@ -2246,7 +2246,7 @@ (macro (_ tokens) ({{#Item [[_ {#Tuple bindings}] {#Item [[_ {#Tuple templates}] data]}]} ({[{#Some bindings'} {#Some data'}] - (let' [apply ("lux type check" (-> Replacement_Environment ($' List Code)) + (let' [apply ("lux type check" (-> Replacement_Environment ($ List Code)) (function' [env] (list#each (realized_template env) templates))) num_bindings (list#size bindings')] (if (every? (function' [size] ("lux i64 =" num_bindings size)) @@ -2364,9 +2364,9 @@ type)) (def' .private (named_macro' modules current_module module name) - (-> ($' List (Tuple Text Module)) + (-> ($ List (Tuple Text Module)) Text Text Text - ($' Maybe Macro)) + ($ Maybe Macro)) (do maybe#monad [$module (property#value module modules) gdef (let' [[..#module_hash _ ..#module_aliases _ ..#definitions bindings ..#imports _ ..#module_state _] ("lux type check" Module $module)] @@ -2394,7 +2394,7 @@ ("lux type check" Global gdef)))) (def' .private (named_macro full_name) - (-> Symbol ($' Meta ($' Maybe Macro))) + (-> Symbol ($ Meta ($ Maybe Macro))) (do meta#monad [current_module current_module_name] (let' [[module name] full_name] @@ -2408,7 +2408,7 @@ state))))) (def' .private (macro? name) - (-> Symbol ($' Meta Bit)) + (-> Symbol ($ Meta Bit)) (do meta#monad [name (normal name) output (named_macro name)] @@ -2418,7 +2418,7 @@ (def' .private (list#interposed sep xs) (All (_ a) - (-> a ($' List a) ($' List a))) + (-> a ($ List a) ($ List a))) ({{#End} xs @@ -2430,7 +2430,7 @@ xs)) (def' .private (single_expansion token) - (-> Code ($' Meta ($' List Code))) + (-> Code ($ Meta ($ List Code))) ({[_ {#Form {#Item [_ {#Symbol name}] args}}] (do meta#monad [name' (normal name) @@ -2446,8 +2446,8 @@ (meta#in (list token))} token)) -(def' .private (expansion token) - (-> Code ($' Meta ($' List Code))) +(def' .private (complete_expansion token) + (-> Code ($ Meta ($ List Code))) ({[_ {#Form {#Item [_ {#Symbol name}] args}}] (do meta#monad [name' (normal name) @@ -2455,7 +2455,7 @@ ({{#Some macro} (do meta#monad [top_level_expansion (("lux type as" Macro' macro) args) - recursive_expansion (monad#each meta#monad expansion top_level_expansion)] + recursive_expansion (monad#each meta#monad complete_expansion top_level_expansion)] (in (list#conjoint recursive_expansion))) {#None} @@ -2466,26 +2466,26 @@ (meta#in (list token))} token)) -(def' .private (full_expansion' full_expansion @name name args) - (-> (-> Code ($' Meta ($' List Code))) Location Symbol ($' List Code) ($' Meta ($' List Code))) +(def' .private (total_expansion' total_expansion @name name args) + (-> (-> Code ($ Meta ($ List Code))) Location Symbol ($ List Code) ($ Meta ($ List Code))) (do meta#monad [name' (normal name) ?macro (named_macro name')] ({{#Some macro} (do meta#monad [expansion (("lux type as" Macro' macro) args) - expansion' (monad#each meta#monad full_expansion expansion)] + expansion' (monad#each meta#monad total_expansion expansion)] (in (list#conjoint expansion'))) {#None} (do meta#monad - [args' (monad#each meta#monad full_expansion args)] + [args' (monad#each meta#monad total_expansion args)] (in (list (form$ {#Item [@name {#Symbol name}] (list#conjoint args')}))))} ?macro))) (def' .private (in_module module meta) (All (_ a) - (-> Text ($' Meta a) ($' Meta a))) + (-> Text ($ Meta a) ($ Meta a))) (function' [lux] ({[..#info info ..#source source ..#current_module current_module ..#modules modules @@ -2522,26 +2522,26 @@ ..#eval eval]))} lux))) -(def' .private (full_expansion syntax) - (-> Code ($' Meta ($' List Code))) +(def' .private (total_expansion syntax) + (-> Code ($ Meta ($ List Code))) ({[_ {#Form {#Item head tail}}] ({[@name {#Symbol name}] - (..full_expansion' full_expansion @name name tail) + (..total_expansion' total_expansion @name name tail) _ (do meta#monad - [members' (monad#each meta#monad full_expansion {#Item head tail})] + [members' (monad#each meta#monad total_expansion {#Item head tail})] (in (list (form$ (list#conjoint members')))))} head) [_ {#Variant members}] (do meta#monad - [members' (monad#each meta#monad full_expansion members)] + [members' (monad#each meta#monad total_expansion members)] (in (list (variant$ (list#conjoint members'))))) [_ {#Tuple members}] (do meta#monad - [members' (monad#each meta#monad full_expansion members)] + [members' (monad#each meta#monad total_expansion members)] (in (list (tuple$ (list#conjoint members'))))) _ @@ -2598,7 +2598,7 @@ code)) (def' .private (normal_type type) - (-> Code ($' Meta Code)) + (-> Code ($ Meta Code)) ({[_ {#Variant {#Item [_ {#Symbol symbol}] parts}}] (do meta#monad [parts (monad#each meta#monad normal_type parts)] @@ -2656,7 +2656,7 @@ type)) (def' .private (with_quantification' body lux) - (-> ($' Meta Code) ($' Meta Code)) + (-> ($ Meta Code) ($ Meta Code)) (let' [[..#info info/pre ..#source source/pre ..#current_module current_module/pre @@ -2729,7 +2729,7 @@ [initialized_quantification? (function' [lux] {#Right [lux (initialized_quantification? lux)]})] (if initialized_quantification? (do meta#monad - [type+ (full_expansion type)] + [type+ (total_expansion type)] ({{#Item type' {#End}} (do meta#monad [type'' (normal_type type')] @@ -2774,7 +2774,7 @@ (def' .private (empty? xs) (All (_ a) - (-> ($' List a) Bit)) + (-> ($ List a) Bit)) ({{#End} #1 _ #0} xs)) @@ -2790,7 +2790,7 @@ [product#right b y]) (def' .private (generated_symbol prefix state) - (-> Text ($' Meta Code)) + (-> Text ($ Meta Code)) ({[..#info info ..#source source ..#current_module _ ..#modules modules ..#scopes scopes ..#type_context types ..#host host ..#seed seed ..#expected expected @@ -2819,6 +2819,172 @@ (failure (..wrong_syntax_error (symbol ..exec)))} (list#reversed tokens)))) +(with_template [ ] + [(def' .private ( type) + (type_literal (-> Type (List Type))) + ({{ left right} + (list#partial left ( right)) + + _ + (list type)} + type))] + + [flat_variant #Sum] + [flat_tuple #Product] + [flat_lambda #Function] + ) + +(def' .private (flat_application type) + (type_literal (-> Type [Type (List Type)])) + ({{#Apply head func'} + (let' [[func tail] (flat_application func')] + [func {#Item head tail}]) + + _ + [type (list)]} + type)) + +(def' .private (type#encoded type) + (-> Type Text) + ({{#Primitive name params} + ({{#End} + name + + _ + (all text#composite "(" name " " (|> params (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) ")")} + params) + + {#Sum _} + (all text#composite "{" (|> (flat_variant type) (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) "}") + + {#Product _} + (all text#composite "[" (|> (flat_tuple type) (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) "]") + + {#Function _} + (all text#composite "(-> " (|> (flat_lambda type) (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) ")") + + {#Parameter id} + (nat#encoded id) + + {#Var id} + (all text#composite "-" (nat#encoded id)) + + {#Ex id} + (all text#composite "+" (nat#encoded id)) + + {#UnivQ env body} + (all text#composite "(All " (type#encoded body) ")") + + {#ExQ env body} + (all text#composite "(Ex " (type#encoded body) ")") + + {#Apply _} + (let' [[func args] (flat_application type)] + (all text#composite + "(" (type#encoded func) " " + (|> args (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) + ")")) + + {#Named name _} + (symbol#encoded name)} + type)) + +(def' .private (meta#try it) + (type_literal (All (_ a) (-> (Meta a) (Meta (Either Text a))))) + (function' [state] + ({{#Left error} + {#Right [state {#Left error}]} + + {#Right [state output]} + {#Right [state {#Right output}]}} + (it state)))) + +(def' .private (anonymous_type it) + (-> Type Type) + ({{#Named _ it} + (anonymous_type it) + + _ + it} + it)) + +(def' .private static' + (type_literal (-> Bit Code (Meta Code))) + (let' [simple_literal (is (-> Symbol (Meta Code)) + (function' [name] + (do meta#monad + [type+value (meta#try (definition_value name))] + ({{#Left error} + (in (symbol$ name)) + + {#Right [type value]} + ({{#Primitive "#Bit" {#End}} + (in (bit$ (as Bit value))) + + {#Primitive "#Frac" {#End}} + (in (frac$ (as Frac value))) + + {#Primitive "#Text" {#End}} + (in (text$ (as Text value))) + + {#Primitive "#I64" {#Item {#Primitive "#Nat" {#End}} {#End}}} + (in (nat$ (as Nat value))) + + {#Primitive "#I64" {#Item {#Primitive "#Int" {#End}} {#End}}} + (in (int$ (as Int value))) + + {#Primitive "#I64" {#Item {#Primitive "#Rev" {#End}} {#End}}} + (in (rev$ (as Rev value))) + + _ + (failure (all text#composite + "Invalid static value: " (symbol#encoded name) + " : " (type#encoded type)))} + (anonymous_type type))} + type+value))))] + (function' literal [only_global? token] + ({[_ {#Symbol [def_module def_name]}] + (if (text#= "" def_module) + (if only_global? + (meta#in (symbol$ [def_module def_name])) + (do meta#monad + [current_module current_module_name] + (simple_literal [current_module def_name]))) + (simple_literal [def_module def_name])) + + [meta {#Form parts}] + (do meta#monad + [=parts (monad#each meta#monad (literal only_global?) parts)] + (in [meta {#Form =parts}])) + + [meta {#Variant parts}] + (do meta#monad + [=parts (monad#each meta#monad (literal only_global?) parts)] + (in [meta {#Variant =parts}])) + + [meta {#Tuple parts}] + (do meta#monad + [=parts (monad#each meta#monad (literal only_global?) parts)] + (in [meta {#Tuple =parts}])) + + _ + ... TODO: Figure out why this doesn't work: + ... (at meta#monad in token) + (meta#in token)} + token)))) + +(def' .public static + Macro + (macro (_ tokens) + ({{#Item pattern {#End}} + (do meta#monad + [pattern' (static' #0 pattern)] + (in (list pattern'))) + + _ + (failure (..wrong_syntax_error (symbol ..static)))} + tokens))) + (def' .public Pattern Type {#Primitive "#Macro/Pattern" {#End}}) @@ -2836,7 +3002,8 @@ Code Code (List Code) (Meta (List Code)))) (do meta#monad - [pattern (one_expansion (full_expansion pattern)) + [pattern (one_expansion (total_expansion pattern)) + pattern (static' #1 pattern) branches (case_expansion branches)] (in (list#partial pattern body branches)))) @@ -2867,11 +3034,11 @@ (meta#in (list)) _ - (failure (all text#composite "'lux.case' expects an even number of tokens: " (|> branches - (list#each code#encoded) - (list#interposed " ") - list#reversed - (list#mix text#composite ""))))} + (failure (all text#composite "'case' expects an even number of tokens: " (|> branches + (list#each code#encoded) + (list#interposed " ") + list#reversed + (list#mix text#composite ""))))} branches)) (def' .public case @@ -3405,31 +3572,6 @@ _ {#None})) -(with_template [ ] - [(def ( type) - (-> Type (List Type)) - (case type - { left right} - (list#partial left ( right)) - - _ - (list type)))] - - [flat_variant #Sum] - [flat_tuple #Product] - [flat_lambda #Function] - ) - -(def (flat_application type) - (-> Type [Type (List Type)]) - (case type - {#Apply head func'} - (let [[func tail] (flat_application func')] - [func {#Item head tail}]) - - _ - [type (list)])) - (def (interface_methods type) (-> Type (Maybe (List Type))) (case type @@ -3542,56 +3684,10 @@ {#None} {#Left "Not expecting any type."})))) -(def (type#encoded type) - (-> Type Text) - (case type - {#Primitive name params} - (case params - {#End} - name - - _ - (all text#composite "(" name " " (|> params (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) ")")) - - {#Sum _} - (all text#composite "{" (|> (flat_variant type) (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) "}") - - {#Product _} - (all text#composite "[" (|> (flat_tuple type) (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) "]") - - {#Function _} - (all text#composite "(-> " (|> (flat_lambda type) (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) ")") - - {#Parameter id} - (nat#encoded id) - - {#Var id} - (all text#composite "-" (nat#encoded id)) - - {#Ex id} - (all text#composite "+" (nat#encoded id)) - - {#UnivQ env body} - (all text#composite "(All " (type#encoded body) ")") - - {#ExQ env body} - (all text#composite "(Ex " (type#encoded body) ")") - - {#Apply _} - (let [[func args] (flat_application type)] - (all text#composite - "(" (type#encoded func) " " - (|> args (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) - ")")) - - {#Named name _} - (symbol#encoded name) - )) - (def .public implementation (macro (_ tokens) (do meta#monad - [tokens' (monad#each meta#monad expansion tokens) + [tokens' (monad#each meta#monad complete_expansion tokens) implementation_type ..expected_type tags+type (record_slots implementation_type) tags (is (Meta (List Symbol)) @@ -4942,78 +5038,6 @@ {#None} (failure (..wrong_syntax_error (symbol ..with_expansions))))))) -(def (flat_alias type) - (-> Type Type) - (case type - (with_template#pattern [] - [{#Named ["library/lux" ] _} - type]) - (["Bit"] - ["Nat"] - ["Int"] - ["Rev"] - ["Frac"] - ["Text"]) - - {#Named _ type'} - (flat_alias type') - - _ - type)) - -(def .public static - (let [simple_literal (is (-> Symbol (Meta Code)) - (function (simple_literal name) - (do meta#monad - [type+value (definition_value name) - .let [[type value] type+value]] - (case (flat_alias type) - (with_template#pattern [ ] - [{#Named ["library/lux" ] _} - (in ( (as value)))]) - (["Bit" Bit bit$] - ["Nat" Nat nat$] - ["Int" Int int$] - ["Rev" Rev rev$] - ["Frac" Frac frac$] - ["Text" Text text$]) - - _ - (failure (text#composite "Cannot anti-quote type: " (symbol#encoded name))))))) - literal (is (-> Code (Meta Code)) - (function (literal token) - (case token - [_ {#Symbol [def_module def_name]}] - (if (text#= "" def_module) - (do meta#monad - [current_module current_module_name] - (simple_literal [current_module def_name])) - (simple_literal [def_module def_name])) - - (with_template#pattern [] - [[meta { parts}] - (do meta#monad - [=parts (monad#each meta#monad literal parts)] - (in [meta { =parts}]))]) - ([#Form] - [#Variant] - [#Tuple]) - - _ - (meta#in token) - ... TODO: Figure out why this doesn't work: - ... (at meta#monad in token) - )))] - (macro (_ tokens) - (case tokens - (list pattern) - (do meta#monad - [pattern' (literal pattern)] - (in (list pattern'))) - - _ - (failure (..wrong_syntax_error (symbol ..static))))))) - (def .public (same? reference sample) (All (_ a) (-> a a Bit)) @@ -5145,9 +5169,8 @@ [symbol (..global_symbol symbol) type+value (..definition_value symbol) .let [[type value] type+value]] - (case (..flat_alias type) - (pattern#or {#Primitive "#Text" {#End}} - {#Named ["library/lux" "Text"] {#Primitive "#Text" {#End}}}) + (case (anonymous_type type) + {#Primitive "#Text" {#End}} (in (as ..Text value)) _ @@ -5280,16 +5303,6 @@ (list#mix list#composite (list))) [<@> { (list#each product#right <*>')}]]))])) -(def (meta#try it) - (All (_ a) (-> (Meta a) (Meta (Either Text a)))) - (function (_ state) - (case (it state) - {#Left error} - {#Right [state {#Left error}]} - - {#Right [state output]} - {#Right [state {#Right output}]}))) - (def (embedded_expansions code) (-> Code (Meta [(List Code) Code])) (case code @@ -5376,7 +5389,7 @@ (def .public Interface (macro (_ tokens) (do meta#monad - [methods' (monad#each meta#monad expansion tokens)] + [methods' (monad#each meta#monad complete_expansion tokens)] (case (everyP methodP (list#conjoint methods')) {#Some methods} (in (list (` (..Tuple (,* (list#each product#right methods)))) @@ -5396,7 +5409,7 @@ (case tokens (list [_ {#Symbol "" name}] body) (do meta#monad - [body' (expansion body) + [body' (complete_expansion body) g!self (generated_symbol "g!self") g!dummy (generated_symbol "g!dummy")] (case body' diff --git a/stdlib/source/library/lux/abstract/interval.lux b/stdlib/source/library/lux/abstract/interval.lux index e5ed383fc..fcad3b26d 100644 --- a/stdlib/source/library/lux/abstract/interval.lux +++ b/stdlib/source/library/lux/abstract/interval.lux @@ -161,7 +161,7 @@ (or (singleton? reference) (and (inner? reference) (outer? sample))) - #0 + false ... (and (outer? reference) (inner? sample)) (let [(open ",#[0]") reference] @@ -176,7 +176,7 @@ (let [(open ",#[0]") reference] (and (not (at ..equivalence = reference sample)) (cond (singleton? sample) - #0 + false (singleton? reference) (nested? sample reference) diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux index c492b9b5e..2e0193fbb 100644 --- a/stdlib/source/library/lux/control/concurrency/async.lux +++ b/stdlib/source/library/lux/control/concurrency/async.lux @@ -51,7 +51,7 @@ [(^.let old [_value _observers]) (atom.read! async)] (case _value {.#Some _} - (in #0) + (in false) {.#None} (do ! @@ -60,7 +60,7 @@ (do ! [_ (monad.each ! (function.on (variance.write value)) _observers)] - (in #1)) + (in true)) (resolve value)))))))) (def .public (resolved value) @@ -102,10 +102,10 @@ (at io.functor each (|>> (pipe.case {.#None} - #0 + false {.#Some _} - #1))))) + true))))) (def .public functor (Functor Async) diff --git a/stdlib/source/library/lux/control/concurrency/stm.lux b/stdlib/source/library/lux/control/concurrency/stm.lux index 80a363c74..9762ffa59 100644 --- a/stdlib/source/library/lux/control/concurrency/stm.lux +++ b/stdlib/source/library/lux/control/concurrency/stm.lux @@ -226,7 +226,7 @@ (def commit_processor_flag (Atom Bit) - (atom #0)) + (atom false)) (def (issue_commit! commit) (All (_ a) (-> (Commit a) (IO Any))) @@ -264,7 +264,7 @@ (if flag (in []) (do ! - [was_first? (atom.compare_and_swap! flag #1 commit_processor_flag)] + [was_first? (atom.compare_and_swap! flag true commit_processor_flag)] (if was_first? (do ! [[async resolve] (atom.read! pending_commits)] diff --git a/stdlib/source/library/lux/control/maybe.lux b/stdlib/source/library/lux/control/maybe.lux index a48e3661e..a3741b3c3 100644 --- a/stdlib/source/library/lux/control/maybe.lux +++ b/stdlib/source/library/lux/control/maybe.lux @@ -77,13 +77,13 @@ (def (= mx my) (case [mx my] [{.#None} {.#None}] - #1 + true [{.#Some x} {.#Some y}] (at super = x y) _ - #0)))) + false)))) (def .public (hash super) (All (_ a) (-> (Hash a) (Hash (Maybe a)))) diff --git a/stdlib/source/library/lux/data/collection/bits.lux b/stdlib/source/library/lux/data/collection/bits.lux index ba33e6fac..b036bb9dc 100644 --- a/stdlib/source/library/lux/data/collection/bits.lux +++ b/stdlib/source/library/lux/data/collection/bits.lux @@ -105,7 +105,7 @@ ("lux i64 =" empty_chunk) .not) (again (++ idx))) - #0)))) + false)))) (def .public (not input) (-> Bits Bits) @@ -174,4 +174,4 @@ (..chunk idx reference) (..chunk idx sample)) (again (++ idx))) - #1)))))) + true)))))) diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux index dcbaf5621..99badd2bc 100644 --- a/stdlib/source/library/lux/data/collection/dictionary.lux +++ b/stdlib/source/library/lux/data/collection/dictionary.lux @@ -289,12 +289,12 @@ ... So, this test is introduced to detect them. (def (node#empty? node) (All (_ k v) (-> (Node k v) Bit)) - (`` (case node - {#Base (,, (static ..clean_bitmap)) _} - #1 + (case node + {#Base ..clean_bitmap _} + true - _ - #0))) + _ + false)) (def (node#has level hash key val key_hash node) (All (_ k v) (-> Level Hash_Code k v (Hash k) (Node k v) (Node k v))) @@ -593,8 +593,11 @@ (def .public (key? dict key) (All (_ k v) (-> (Dictionary k v) k Bit)) (case (value key dict) - {.#None} #0 - {.#Some _} #1)) + {.#None} + false + + {.#Some _} + true)) (exception .public key_already_exists) @@ -703,7 +706,7 @@ (,#= rv sv) _ - #0)) + false)) (..entries reference)))))) (def node_functor diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux index 4f0254bbb..44848eae6 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux @@ -91,7 +91,7 @@ (loop (again [node (the #root dict)]) (case node {.#None} - #0 + false {.#Some node} (let [node_key (the #key node)] @@ -484,13 +484,13 @@ (if (_#= root_key key) [(prepended (the #left root) (the #right root)) - #1] + true] (let [go_left? (_#< root_key key)] (case (again (if go_left? (the #left root) (the #right root))) - [{.#None} #0] - [{.#None} #0] + [{.#None} .false] + [{.#None} false] [side_outcome _] (if go_left? @@ -498,25 +498,25 @@ (^.multi {.#Some left} [(the #color left) {#Black}]) [{.#Some (without_left root_key root_val side_outcome (the #right root))} - #0] + false] _ [{.#Some (red root_key root_val side_outcome (the #right root))} - #0]) + false]) (case (the #right root) (^.multi {.#Some right} [(the #color right) {#Black}]) [{.#Some (without_right root_key root_val (the #left root) side_outcome)} - #0] + false] _ [{.#Some (red root_key root_val (the #left root) side_outcome)} - #0]) + false]) ))) )) {.#None} - [{.#None} #0] + [{.#None} false] ))] (case ?root {.#None} @@ -572,7 +572,7 @@ entriesS (entries sample)]) (case [entriesR entriesS] [{.#End} {.#End}] - #1 + true [{.#Item [keyR valueR] entriesR'} {.#Item [keyS valueS] entriesS'}] (and (/#= keyR keyS) @@ -580,4 +580,4 @@ (again entriesR' entriesS')) _ - #0)))))) + false)))))) diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux index dca6d6ec4..4114acd8e 100644 --- a/stdlib/source/library/lux/data/collection/list.lux +++ b/stdlib/source/library/lux/data/collection/list.lux @@ -315,15 +315,14 @@ (def (= xs ys) (case [xs ys] [{.#End} {.#End}] - #1 + true [{.#Item x xs'} {.#Item y ys'}] (and (at Equivalence = x y) (= xs' ys')) [_ _] - #0 - )))) + false)))) (def .public (hash super) (All (_ a) (-> (Hash a) (Hash (List a)))) @@ -422,7 +421,7 @@ (All (_ a) (-> (Equivalence a) (List a) a Bit)) (case xs {.#End} - #0 + false {.#Item x' xs'} (or (at eq = x x') diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux index f36cac720..060c5a255 100644 --- a/stdlib/source/library/lux/data/collection/sequence.lux +++ b/stdlib/source/library/lux/data/collection/sequence.lux @@ -266,10 +266,10 @@ (exception.except ..base_was_not_found []) (case [(n.> branching_exponent level) (array.item index hierarchy)] - [#1 {#Hierarchy sub}] + [.true {#Hierarchy sub}] (again (level_down level) sub) - [#0 {#Base base}] + [.false {#Base base}] {try.#Success base} _ @@ -383,7 +383,7 @@ (array.= (node_equivalence //#=) h1 h2) _ - #0)))) + false)))) (def .public (equivalence //#=) (All (_ a) (-> (Equivalence a) (Equivalence (Sequence a)))) diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux index 895a6931f..3dd15f400 100644 --- a/stdlib/source/library/lux/data/format/json.lux +++ b/stdlib/source/library/lux/data/format/json.lux @@ -184,7 +184,7 @@ (def (= x y) (case [x y] [{#Null} {#Null}] - #1 + true (^.with_template [ ] [[{ x'} { y'}] @@ -197,12 +197,12 @@ (and (n.= (sequence.size xs) (sequence.size ys)) (list#mix (function (_ idx prev) (and prev - (maybe.else #0 + (maybe.else false (do maybe.monad [x' (sequence.item idx xs) y' (sequence.item idx ys)] (in (= x' y')))))) - #1 + true (list.indices (sequence.size xs)))) [{#Object xs} {#Object ys}] @@ -210,13 +210,13 @@ (list#mix (function (_ [xk xv] prev) (and prev (case (dictionary.value xk ys) - {.#None} #0 + {.#None} false {.#Some yv} (= xv yv)))) - #1 + true (dictionary.entries xs))) _ - #0)))) + false)))) ............................................................ ............................................................ @@ -229,8 +229,11 @@ (def boolean_format (-> Boolean Text) (|>> (pipe.case - #0 "false" - #1 "true"))) + .false + "false" + + .true + "true"))) (def number_format (-> Number Text) @@ -331,8 +334,8 @@ [_ (.this )] (in )))] - [true_parser "true" #1] [false_parser "false" #0] + [true_parser "true" #1] ) (def boolean_parser diff --git a/stdlib/source/library/lux/data/text/escape.lux b/stdlib/source/library/lux/data/text/escape.lux index 3bf1a53dd..85f038d05 100644 --- a/stdlib/source/library/lux/data/text/escape.lux +++ b/stdlib/source/library/lux/data/text/escape.lux @@ -74,7 +74,7 @@ (n.> ..ascii_top char) (case char (^.with_template [] - [(static ) + [ true]) ([..\0] [..\a] [..\b] [..\t] [..\n] [..\v] [..\f] [..\r] @@ -119,7 +119,7 @@ (if (n.< limit offset) (case ("lux text char" offset current) (^.with_template [ ] - [(static ) + [ (let [[previous' current' limit'] (ascii_escaped offset limit previous current)] (again 0 previous' current' limit'))]) ([..\0 ..escaped_\0] @@ -202,12 +202,12 @@ limit ("lux text size" text)]) (if (n.< limit offset) (case ("lux text char" offset current) - (static ..sigil_char) + ..sigil_char (let [@sigil (++ offset)] (if (n.< limit @sigil) (case ("lux text char" @sigil current) (^.with_template [ ] - [(static ) + [ (let [[previous' current' limit'] (..ascii_un_escaped offset previous current limit)] (again 0 previous' current' limit'))]) ([..\0_sigil //.\0] @@ -221,7 +221,7 @@ [..\''_sigil //.\''] [..\\_sigil ..sigil]) - (static ..\u_sigil) + ..\u_sigil (let [@unicode (n.+ code_size @sigil)] (if (n.< limit @unicode) (do try.monad diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux index e7ee4984a..d8d094f6e 100644 --- a/stdlib/source/library/lux/data/text/regex.lux +++ b/stdlib/source/library/lux/data/text/regex.lux @@ -391,7 +391,7 @@ (all <>.either (do <>.monad [_ (.this "(?:") - [_ scoped] (re_alternative^ #0 re_scoped^ current_module) + [_ scoped] (re_alternative^ false re_scoped^ current_module) _ (.this ")")] (in [{#Non_Capturing} scoped])) (do <>.monad @@ -401,18 +401,18 @@ [_ (.this "(?<") captured_symbol symbol_part^ _ (.this ">") - [num_captures pattern] (re_alternative^ #1 re_scoped^ current_module) + [num_captures pattern] (re_alternative^ true re_scoped^ current_module) _ (.this ")")] (in [{#Capturing [{.#Some captured_symbol} num_captures]} pattern])) (do <>.monad [_ (.this "(") - [num_captures pattern] (re_alternative^ #1 re_scoped^ current_module) + [num_captures pattern] (re_alternative^ true re_scoped^ current_module) _ (.this ")")] (in [{#Capturing [{.#None} num_captures]} pattern])))) (def (regex^ current_module) (-> Text (Parser Code)) - (at <>.monad each product.right (re_alternative^ #1 re_scoped^ current_module))) + (at <>.monad each product.right (re_alternative^ true re_scoped^ current_module))) (def .public regex (syntax (_ [pattern .text]) diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux index d2052c074..c12774068 100644 --- a/stdlib/source/library/lux/documentation.lux +++ b/stdlib/source/library/lux/documentation.lux @@ -9,6 +9,7 @@ ["[0]" maybe (.use "[1]#[0]" functor)] ["[0]" exception (.only exception)]] [data + ["[0]" sum] ["[0]" product] ["[0]" text (.only \n) (.use "[1]#[0]" order) ["%" \\format (.only format)]] @@ -685,30 +686,31 @@ (..listing un_expected))) ))) -(def .public markdown +(def .public (markdown it) (-> (List Documentation) Text) - (|>> (list#mix (function (_ doc it) - (case doc - {#Module doc} - (if (dictionary.key? it (the #module doc)) - it - (dictionary.has (the #module doc) [doc (list)] it)) - - {#Definition doc} - (let [module (symbol.module (the #global doc))] - (if (dictionary.key? it module) - (dictionary.revised module - (function (_ [module defs]) - [module (list.partial doc defs)]) - it) - it)))) - (is (Dictionary Text [Module (List Definition)]) - (dictionary.empty text.hash))) - dictionary.values - (list.sorted (function (_ left right) - (text#< (the #module (product.left right)) - (the #module (product.left left))))) - (list#each ..module_documentation) - (list.interposed md.horizontal_rule) - (list#mix md.then (is (Markdown Block) md.empty)) - md.markdown)) + (let [with_modules (list#mix (function (_ doc it) + (if (dictionary.key? it (the #module doc)) + it + (dictionary.has (the #module doc) [doc (list)] it))) + (is (Dictionary Text [Module (List Definition)]) + (dictionary.empty text.hash)) + (sum.rights it)) + with_definitions (list#mix (function (_ doc it) + (let [module (symbol.module (the #global doc))] + (if (dictionary.key? it module) + (dictionary.revised module + (function (_ [module defs]) + [module (list.partial doc defs)]) + it) + it))) + with_modules + (sum.lefts it))] + (|> with_definitions + dictionary.values + (list.sorted (function (_ left right) + (text#< (the #module (product.left right)) + (the #module (product.left left))))) + (list#each ..module_documentation) + (list.interposed md.horizontal_rule) + (list#mix md.then (is (Markdown Block) md.empty)) + md.markdown))) diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux index f9fd3472a..b244493a6 100644 --- a/stdlib/source/library/lux/ffi.jvm.lux +++ b/stdlib/source/library/lux/ffi.jvm.lux @@ -1129,12 +1129,12 @@ (case (dictionary.value field fields) {.#Some [member {#VariableField _ static? :field:}]} (case [static? this] - [#1 {.#None}] + [.true {.#None}] (in (list (` ("jvm member get static" (, (code.text class_name)) (, (code.text (the #member_name member))))))) - [#0 {.#Some this}] + [.false {.#Some this}] (in (list (` ("jvm member get virtual" (, (code.text class_name)) (, (code.text (the #member_name member))) @@ -1164,13 +1164,13 @@ _ (case [static? this] - [#1 {.#None}] + [.true {.#None}] (in (list (` ("jvm member put static" (, (code.text class_name)) (, (code.text (the #member_name member))) (, value))))) - [#0 {.#Some this}] + [.false {.#Some this}] (in (list (` ("jvm member put virtual" (, (code.text class_name)) (, (code.text (the #member_name member))) diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux index 7bcd63ce1..2208f9ee4 100644 --- a/stdlib/source/library/lux/ffi.old.lux +++ b/stdlib/source/library/lux/ffi.old.lux @@ -329,12 +329,12 @@ (-> Primitive_Mode (List Type_Parameter) Bit GenericType Code) Code) (case [name+params mode in_array?] - (^.multi [[prim {.#End}] {#ManualPrM} #0] + (^.multi [[prim {.#End}] {#ManualPrM} .false] [(manual_primitive_type prim) {.#Some output}]) output - (^.multi [[prim {.#End}] {#AutoPrM} #0] + (^.multi [[prim {.#End}] {#AutoPrM} .false] [(auto_primitive_type prim) {.#Some output}]) output @@ -363,7 +363,7 @@ class_type') {#GenericArray param} - (let [=param (class_type' mode type_params #1 param)] + (let [=param (class_type' mode type_params true param)] (` (array.Array (, =param)))) (^.or {#GenericWildcard {.#None}} @@ -376,7 +376,7 @@ (def (class_type mode type_params class) (-> Primitive_Mode (List Type_Parameter) GenericType Code) - (class_type' mode type_params #0 class)) + (class_type' mode type_params false class)) (def (type_param_type$ [name bounds]) (-> Type_Parameter Code) @@ -1414,8 +1414,11 @@ (def (free_type_param? [name bounds]) (-> Type_Parameter Bit) (case bounds - {.#End} #1 - _ #0)) + {.#End} + true + + _ + false)) (def (lux_type_parameter [name _]) (-> Type_Parameter Code) diff --git a/stdlib/source/library/lux/ffi/export.rb.lux b/stdlib/source/library/lux/ffi/export.rb.lux index 7a102720a..62fa2b691 100644 --- a/stdlib/source/library/lux/ffi/export.rb.lux +++ b/stdlib/source/library/lux/ffi/export.rb.lux @@ -138,8 +138,8 @@ (at ! each (list#each (function (_ [name term]) (` ( (,* (case name {#Method name} - (list (code.bit #0) (code.text name)) + (list (code.bit false) (code.text name)) {#Global name} - (list (code.bit #1) (code.text name)))) + (list (code.bit true) (code.text name)))) (, term))))))))))) diff --git a/stdlib/source/library/lux/math/number.lux b/stdlib/source/library/lux/math/number.lux index ef699d5d5..8e1233bf3 100644 --- a/stdlib/source/library/lux/math/number.lux +++ b/stdlib/source/library/lux/math/number.lux @@ -23,10 +23,10 @@ (-> Text Bit) (case ("lux text index" 0 ..separator number) {.#Some 0} - #1 + true _ - #0)) + false)) (def without_separators (-> Text Text) diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux index a11b95741..05811c9cc 100644 --- a/stdlib/source/library/lux/math/number/frac.lux +++ b/stdlib/source/library/lux/math/number/frac.lux @@ -718,13 +718,13 @@ (case [(is Nat (..exponent it)) (is Nat (..mantissa it)) (is Nat (..sign it))] - [(static ..special_exponent_bits) 0 0] + [..special_exponent_bits 0 0] ..positive_infinity - [(static ..special_exponent_bits) 0 1] + [..special_exponent_bits 0 1] ..negative_infinity - [(static ..special_exponent_bits) _ _] + [..special_exponent_bits _ _] ..not_a_number ... Positive zero diff --git a/stdlib/source/library/lux/math/number/int.lux b/stdlib/source/library/lux/math/number/int.lux index d5a563dd5..2dfb5e7b8 100644 --- a/stdlib/source/library/lux/math/number/int.lux +++ b/stdlib/source/library/lux/math/number/int.lux @@ -32,7 +32,7 @@ (def .public (<= reference sample) (-> Int Int Bit) (if ("lux i64 <" reference sample) - #1 + true ("lux i64 =" reference sample))) (def .public (> reference sample) @@ -42,7 +42,7 @@ (def .public (>= reference sample) (-> Int Int Bit) (if ("lux i64 <" sample reference) - #1 + true ("lux i64 =" reference sample))) (with_template [ ] @@ -222,13 +222,13 @@ (let [input_size ("lux text size" repr)] (if (//nat.> 1 input_size) (case ("lux text clip" 0 1 repr) - (static ..+sign) + ..+sign (|> repr ("lux text clip" 1 (-- input_size)) (at decoded) (at try.functor each (|>> .int))) - (static ..-sign) + ..-sign (|> repr ("lux text clip" 1 (-- input_size)) (at decoded) diff --git a/stdlib/source/library/lux/math/number/nat.lux b/stdlib/source/library/lux/math/number/nat.lux index c502f4d96..cef20dca2 100644 --- a/stdlib/source/library/lux/math/number/nat.lux +++ b/stdlib/source/library/lux/math/number/nat.lux @@ -38,12 +38,12 @@ (let [referenceH (..high reference) sampleH (..high sample)] (if ("lux i64 <" referenceH sampleH) - #1 + true (if ("lux i64 =" referenceH sampleH) ("lux i64 <" (..low reference) (..low sample)) - #0)))) + false)))) (def .public (<= reference sample) (-> Nat Nat Bit) diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux index 54f31901a..c2123fa99 100644 --- a/stdlib/source/library/lux/meta.lux +++ b/stdlib/source/library/lux/meta.lux @@ -140,12 +140,13 @@ (def (macro_type? type) (-> Type Bit) - (`` (case type - {.#Named [(,, (static .prelude)) "Macro"] {.#Primitive "#Macro" {.#End}}} - true + (case type + {.#Named [.prelude "Macro"] + {.#Primitive "#Macro" {.#End}}} + true - _ - false))) + _ + false)) (def .public (normal name) (-> Symbol (Meta Symbol)) @@ -209,10 +210,10 @@ (function (_ lux) {try.#Success [lux (case (property.value module (the .#modules lux)) {.#Some _} - #1 + true {.#None} - #0)]})) + false)]})) (def (on_either f x1 x2) (All (_ a b) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/coverage.lux b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/coverage.lux index 4756538e2..45097d4a5 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/coverage.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/coverage.lux @@ -86,7 +86,7 @@ (def (= reference sample) (case [reference sample] [{#Exhaustive} {#Exhaustive}] - #1 + true [{#Bit sideR} {#Bit sideS}] (bit#= sideR sideS) @@ -117,7 +117,7 @@ (list.zipped_2 flatR flatS)))) _ - #0)))) + false)))) (use "/#[0]" ..equivalence) @@ -251,10 +251,10 @@ (-> Coverage Bit) (case coverage {#Exhaustive} - #1 + true _ - #0)) + false)) ... After determining the coverage of each individual pattern, it is ... necessary to merge them all to figure out if the entire @@ -326,7 +326,7 @@ [{#Seq leftA rightA} {#Seq leftSF rightSF}] (case [(/#= leftSF leftA) (/#= rightSF rightA)] ... Same prefix - [#1 #0] + [.true .false] (do try.monad [rightM (composite rightA rightSF)] (in (if (..exhaustive? rightM) @@ -337,17 +337,17 @@ {#Seq leftSF rightM}))) ... Same suffix - [#0 #1] + [.false .true] (do try.monad [leftM (composite leftA leftSF)] (in {#Seq leftM rightA})) ... The 2 sequences cannot possibly be merged. - [#0 #0] + [.false .false] ... There is nothing the addition adds to the coverage. - [#1 #1] + [.true .true] ) ... The addition cannot possibly improve the coverage. diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/module.lux b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/module.lux index dbaa9e8b0..8284b0301 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/module.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/module.lux @@ -110,7 +110,12 @@ (|> state (the .#modules) (property.value module) - (pipe.case {.#Some _} #1 {.#None} #0) + (pipe.case + {.#Some _} + true + + {.#None} + false) [state] {try.#Success})))) @@ -162,8 +167,11 @@ (case (|> state (the .#modules) (property.value module_name)) {.#Some module} (let [active? (case (the .#module_state module) - {.#Active} #1 - _ #0)] + {.#Active} + true + + _ + false)] (if active? {try.#Success [(revised .#modules (property.has module_name (has .#module_state {} module)) @@ -184,8 +192,11 @@ {.#Some module} {try.#Success [state (case (the .#module_state module) - {} #1 - _ #0)]} + {} + true + + _ + false)]} {.#None} ((///extension.up (/.except ..unknown_module module_name)) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux index 09010717a..e072e7d9d 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux @@ -395,7 +395,7 @@ (def lux_array_type (template (_ :read: :write:) - [{.#Primitive (static array.type_name) (list {.#Apply :write: {.#Apply :read: _Mutable}})}])) + [{.#Primitive array.type_name (list {.#Apply :write: {.#Apply :read: _Mutable}})}])) (def (jvm_type luxT) (-> .Type (Operation (Type Value))) @@ -1016,7 +1016,7 @@ (in false))))) (in (case [(type#= java/lang/Object fromT) (parser.array? toJT)] - [#1 {.#Some _}] + [.true {.#Some _}] true _ @@ -2502,7 +2502,7 @@ (do pool.monad [constant (`` (|> value (,, (template.spliced )))) attribute (attribute.constant constant)] - (field.field ..constant::modifier name #1 (sequence.sequence attribute)))]) + (field.field ..constant::modifier name true (sequence.sequence attribute)))]) ([.#Bit jvm.boolean [(pipe.case #0 +0 #1 +1) .i64 i32.i32 constant.integer pool.integer]] [.#Int jvm.byte [.i64 i32.i32 constant.integer pool.integer]] [.#Int jvm.short [.i64 i32.i32 constant.integer pool.integer]] @@ -2521,7 +2521,7 @@ ... TODO: Handle annotations. {#Variable [name visibility state annotations type]} (field.field (modifier#composite visibility state) - name #1 type sequence.empty))) + name true type sequence.empty))) (def method_privacy (-> ffi.Privacy (Modifier method.Method)) @@ -2591,7 +2591,7 @@ method.strict modifier.empty)) ..constructor_name - #0 (jvm.method [variables (list#each product.right arguments) jvm.void exceptions]) + false (jvm.method [variables (list#each product.right arguments) jvm.void exceptions]) (list) {.#Some (all _.composite (_.aload 0) @@ -2612,7 +2612,7 @@ method.strict modifier.empty)) name - #0 (jvm.method [variables (list#each product.right arguments) return exceptions]) + false (jvm.method [variables (list#each product.right arguments) return exceptions]) (list) {.#Some (..mock_return return)}) @@ -2628,7 +2628,7 @@ method.final modifier.empty)) name - #0 (jvm.method [variables (list#each product.right arguments) return exceptions]) + false (jvm.method [variables (list#each product.right arguments) return exceptions]) (list) {.#Some (..mock_return return)}) @@ -2642,7 +2642,7 @@ method.strict modifier.empty)) name - #0 (jvm.method [variables (list#each product.right arguments) return exceptions]) + false (jvm.method [variables (list#each product.right arguments) return exceptions]) (list) {.#Some (..mock_return return)}) @@ -2652,7 +2652,7 @@ method.abstract (..method_privacy privacy)) name - #0 (jvm.method [variables (list#each product.right arguments) return exceptions]) + false (jvm.method [variables (list#each product.right arguments) return exceptions]) (list) {.#None}) )) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux index 9585f0521..16dc3bc08 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux @@ -236,7 +236,7 @@ (do pool.monad [constant (`` (|> value (,, (template.spliced )))) attribute (attribute.constant constant)] - (field.field ..constant::modifier name #1 (sequence.sequence attribute)))]) + (field.field ..constant::modifier name true (sequence.sequence attribute)))]) ([.#Bit type.boolean [(pipe.case #0 +0 #1 +1) .i64 i32.i32 constant.integer pool.integer]] [.#Int type.byte [.i64 i32.i32 constant.integer pool.integer]] [.#Int type.short [.i64 i32.i32 constant.integer pool.integer]] @@ -260,7 +260,7 @@ modifier.empty) visibility state) - name #1 type sequence.empty))) + name true type sequence.empty))) (def annotation_parameter_synthesis (.Parser (jvm.Annotation_Parameter Synthesis)) @@ -482,7 +482,7 @@ method.strict modifier.empty)) ..constructor_name - #1 (type.method [method_tvars argumentsT type.void exceptions]) + true (type.method [method_tvars argumentsT type.void exceptions]) (list) {.#Some (all _.composite (_.aload 0) @@ -551,7 +551,7 @@ method.strict modifier.empty)) method_name - #1 (type.method [method_tvars argumentsT returnJ exceptionsJ]) + true (type.method [method_tvars argumentsT returnJ exceptionsJ]) (list) {.#Some (all _.composite (method_arguments 1 argumentsT) @@ -581,7 +581,7 @@ method.final modifier.empty)) method_name - #1 (type.method [method_tvars argumentsT returnJ exceptionsJ]) + true (type.method [method_tvars argumentsT returnJ exceptionsJ]) (list) {.#Some (all _.composite (method_arguments 1 argumentsT) @@ -606,7 +606,7 @@ method.strict modifier.empty)) method_name - #1 (type.method [method_tvars argumentsT returnJ exceptionsJ]) + true (type.method [method_tvars argumentsT returnJ exceptionsJ]) (list) {.#Some (all _.composite (method_arguments 0 argumentsT) @@ -621,7 +621,7 @@ (..method_privacy privacy) method.abstract) name - #1 (type.method [variables (list#each product.right arguments) return exceptions]) + true (type.method [variables (list#each product.right arguments) return exceptions]) (list) {.#None}))) @@ -764,7 +764,7 @@ method.strict modifier.empty)) ..constructor_name - #1 (type.method [variables (list#each product.right arguments) type.void exceptions]) + true (type.method [variables (list#each product.right arguments) type.void exceptions]) (list) {.#Some (all _.composite (_.aload 0) @@ -785,7 +785,7 @@ method.strict modifier.empty)) name - #1 (type.method [variables (list#each product.right arguments) return exceptions]) + true (type.method [variables (list#each product.right arguments) return exceptions]) (list) {.#Some (..mock_return return)}) @@ -801,7 +801,7 @@ method.final modifier.empty)) name - #1 (type.method [variables (list#each product.right arguments) return exceptions]) + true (type.method [variables (list#each product.right arguments) return exceptions]) (list) {.#Some (..mock_return return)}) @@ -815,7 +815,7 @@ method.strict modifier.empty)) name - #1 (type.method [variables (list#each product.right arguments) return exceptions]) + true (type.method [variables (list#each product.right arguments) return exceptions]) (list) {.#Some (..mock_return return)}) @@ -825,7 +825,7 @@ method.abstract (..method_privacy privacy)) name - #1 (type.method [variables (list#each product.right arguments) return exceptions]) + true (type.method [variables (list#each product.right arguments) return exceptions]) (list) {.#None}) )) @@ -933,7 +933,7 @@ method.public method.abstract) /#name - #1 type + true type (list) {.#None}))) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux index b127af8c6..4b93daa97 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux @@ -434,11 +434,11 @@ [_ handlerV] ( archive (as Text name) (let [raw_type (type_literal )] (case target_platform - (^.or (static @.jvm) - (static @.js)) + (^.or @.jvm + @.js) raw_type - (static @.python) + @.python (swapped binary.Binary Binary|Python raw_type) _ diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/jvm/host.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/jvm/host.lux index 8f73277d6..ced11c93e 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/jvm/host.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/jvm/host.lux @@ -1136,7 +1136,7 @@ (_.aload (n.+ inputs_offset (++ register))) (_.putfield class (///reference.foreign_name register) $Object)))))] (method.method method.public "" - #1 (anonymous_init_method env inputsTG) + true (anonymous_init_method env inputsTG) (list) {.#Some (all _.composite (_.aload 0) @@ -1320,7 +1320,7 @@ method.strict modifier#identity)) name - #1 methodT + true methodT (list) {.#Some (all _.composite (prepare_arguments 1 argumentsT) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/field/constant.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/field/constant.lux index 31fb77c7b..cd54bb0f8 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/field/constant.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/field/constant.lux @@ -24,4 +24,4 @@ (def .public (constant name type) (-> Text (Type Value) (Resource Field)) - (field.field ..modifier name #0 type (sequence.sequence))) + (field.field ..modifier name false type (sequence.sequence))) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/field/variable.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/field/variable.lux index 539f43afe..17ef0b605 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/field/variable.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/field/variable.lux @@ -47,7 +47,7 @@ (def .public (variable name type) (-> Text (Type Value) (Resource Field)) - (field.field ..modifier name #0 type (sequence.sequence))) + (field.field ..modifier name false type (sequence.sequence))) (def .public (variables naming amount) (-> (-> Register Text) Nat (List (Resource Field))) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/apply.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/apply.lux index 10de5d326..74a1dac76 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/apply.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/apply.lux @@ -85,7 +85,7 @@ over_extent (i.- (.int apply_arity) (.int function_arity))] (method.method //.modifier ////runtime.apply::name - #0 (////runtime.apply::type apply_arity) + false (////runtime.apply::type apply_arity) (list) {.#Some (case num_partials 0 (all _.composite diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux index 65f3ef2bb..420872a39 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux @@ -46,7 +46,7 @@ (-> (Type Class) Arity Label (Bytecode Any) (Resource Method)) (method.method ..modifier ..name - #0 (..type :it: arity) + false (..type :it: arity) (list) {.#Some (all _.composite (_.set_label @begin) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/init.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/init.lux index 2e551f44d..6a2b7432e 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/init.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/init.lux @@ -95,7 +95,7 @@ offset_partial (is (-> Register Register) (|>> offset_arity (n.+ 1)))] (method.method //.modifier ..name - #0 (..type environment arity) + false (..type environment arity) (list) {.#Some (all _.composite ////reference.this diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/new.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/new.lux index 26f259dce..13dd6b6ee 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/new.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/new.lux @@ -68,7 +68,7 @@ after_arity (is (-> Nat Nat) (|>> after_environment (n.+ 1)))] (method.method //.modifier //init.name - #0 (//init.type environment arity) + false (//init.type environment arity) (list) {.#Some (all _.composite ////reference.this diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/reset.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/reset.lux index bfbacf886..fcb94a4ee 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/reset.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/reset.lux @@ -42,7 +42,7 @@ (def .public (method class environment arity) (-> (Type Class) (Environment Synthesis) Arity (Resource Method)) (method.method //.modifier ..name - #0 (..type class) + false (..type class) (list) {.#Some (all _.composite (if (arity.multiary? arity) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/host.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/host.lux index c5ff3c185..270fb31ab 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/host.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/host.lux @@ -120,9 +120,9 @@ (encoding/name.internal bytecode_name) {.#None} (encoding/name.internal "java.lang.Object") (list) - (list (field.field ..value::modifier //value.field #0 :value: (sequence.sequence))) + (list (field.field ..value::modifier //value.field false :value: (sequence.sequence))) (list (method.method ..init::modifier "" - #0 ..init::type + false ..init::type (list) {.#Some (all _.composite diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/program.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/program.lux index 730a83b19..097959d4c 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/program.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/program.lux @@ -145,7 +145,7 @@ (-> (-> unit.ID Text) (Program (Bytecode Any) Definition)) (let [super_class (|> ..^Object type.reflection reflection.reflection name.internal) main (method.method ..main::modifier "main" - #0 ..main::type + false ..main::type (list) {.#Some (all _.composite program diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/runtime.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/runtime.lux index a728d2b2e..385015373 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/runtime.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/runtime.lux @@ -154,7 +154,7 @@ $right? _.aload_1 $value _.aload_2] (method.method ..modifier ..variant::name - #0 ..variant::type + .false ..variant::type (list) {.#Some (all _.composite new_variant ... A[3] @@ -216,7 +216,7 @@ (def decode_frac::method (method.method ..modifier ..decode_frac::name - #0 ..decode_frac::type + .false ..decode_frac::type (list) {.#Some (..risky @@ -253,7 +253,7 @@ (def (failure name message) (-> Text Text (Resource Method)) (method.method ..modifier name - #0 ..failure::type + .false ..failure::type (list) {.#Some (all _.composite @@ -275,7 +275,7 @@ (def push::method (method.method ..modifier ..push::name - #0 ..push::type + .false ..push::type (list) {.#Some (let [new_stack_frame! (all _.composite @@ -295,7 +295,7 @@ (def case::method (method.method ..modifier ..case::name - #0 ..case::type + .false ..case::type (list) {.#Some (do _.monad @@ -407,7 +407,7 @@ left_projection::method (method.method ..modifier ..left_projection::name - #0 ..projection_type + .false ..projection_type (list) {.#Some (do _.monad @@ -427,7 +427,7 @@ right_projection::method (method.method ..modifier ..right_projection::name - #0 ..projection_type + .false ..projection_type (list) {.#Some (do _.monad @@ -483,7 +483,7 @@ (def try::method (method.method ..modifier ..try::name - #0 ..try::type + .false ..try::type (list) {.#Some (do _.monad @@ -578,7 +578,7 @@ //function/arity.maximum) (list#each (function (_ arity) (method.method method.public ..apply::name - #0 (..apply::type arity) + .false (..apply::type arity) (list) {.#Some (let [previous_inputs (|> arity @@ -593,11 +593,11 @@ _.areturn))}))) (list.partial (method.method (modifier#composite method.public method.abstract) ..apply::name - #0 (..apply::type //function/arity.minimum) + .false (..apply::type //function/arity.minimum) (list) {.#None}))) ::method (method.method method.public "" - #0 //function.init + .false //function.init (list) {.#Some (let [$partials _.iload_1] @@ -616,7 +616,7 @@ partial_count (is (Resource Field) (field.field (modifier#composite field.public field.final) //function/count.field - #0 //function/count.type + .false //function/count.type sequence.empty)) bytecode (<| (\\format.result class.format) try.trusted diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/reference.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/reference.lux index bc1c562c2..ef720c4ae 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/reference.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/reference.lux @@ -35,7 +35,9 @@ @.scheme ... Cannot make all definitions be local variables because of limitations with Kawa. (not ("scheme script universe")) - #0)) + + ... Otherwise... + false)) (def universe_label Text diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/case.lux index e755791ab..d6d6f31ed 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/case.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/case.lux @@ -186,11 +186,11 @@ (if (n.= newL oldL) old )]) - ([/access.#Side #0 /side.#lefts /side.#right?] - [/access.#Side #1 /side.#lefts /side.#right?] + ([/access.#Side .false /side.#lefts /side.#right?] + [/access.#Side .true /side.#lefts /side.#right?] - [/access.#Member #0 /member.#lefts /member.#right?] - [/access.#Member #1 /member.#lefts /member.#right?]) + [/access.#Member .false /member.#lefts /member.#right?] + [/access.#Member .true /member.#lefts /member.#right?]) [{/.#Bind newR} {/.#Bind oldR}] (if (n.= newR oldR) @@ -319,14 +319,14 @@ {.#End}] (..synthesize_let synthesize^ archive inputS @variable body) - (^.or [[(///pattern.bit #1) then] - (list [(///pattern.bit #0) else])] - [[(///pattern.bit #1) then] + (^.or [[(///pattern.bit .true) then] + (list [(///pattern.bit .false) else])] + [[(///pattern.bit .true) then] (list [(///pattern.unit) else])] - [[(///pattern.bit #0) else] - (list [(///pattern.bit #1) then])] - [[(///pattern.bit #0) else] + [[(///pattern.bit .false) else] + (list [(///pattern.bit .true) then])] + [[(///pattern.bit .false) else] (list [(///pattern.unit) then])]) (..synthesize_if synthesize^ archive inputS then else) diff --git a/stdlib/source/library/lux/meta/compiler/reference/variable.lux b/stdlib/source/library/lux/meta/compiler/reference/variable.lux index 80b01b5b8..caa6d2c89 100644 --- a/stdlib/source/library/lux/meta/compiler/reference/variable.lux +++ b/stdlib/source/library/lux/meta/compiler/reference/variable.lux @@ -36,7 +36,7 @@ ([#Local] [#Foreign]) _ - #0)))) + false)))) (def .public hash (Hash Variable) diff --git a/stdlib/source/library/lux/meta/macro/expansion.lux b/stdlib/source/library/lux/meta/macro/expansion.lux index 781eb141b..eb30d4ee8 100644 --- a/stdlib/source/library/lux/meta/macro/expansion.lux +++ b/stdlib/source/library/lux/meta/macro/expansion.lux @@ -112,10 +112,10 @@ (case tokens (list [_ {.#Text "omit"}] token) - {.#Some [#1 token]} + {.#Some [true token]} (list token) - {.#Some [#0 token]} + {.#Some [false token]} _ {.#None})) diff --git a/stdlib/source/library/lux/meta/macro/pattern.lux b/stdlib/source/library/lux/meta/macro/pattern.lux index 367c77bd4..b639259ba 100644 --- a/stdlib/source/library/lux/meta/macro/pattern.lux +++ b/stdlib/source/library/lux/meta/macro/pattern.lux @@ -144,10 +144,10 @@ (.let [inner_pattern_body (list#mix (function (_ [calculation pattern] success) (.let [bind? (case pattern [_ {.#Symbol _}] - #1 + true _ - #0)] + false)] (.` (case (., calculation) (., pattern) (., success) @@ -169,10 +169,10 @@ [mlc (multiP levels) .let [initial_bind? (case mlc [[_ {.#Symbol _}] _] - #1 + true _ - #0)] + false)] expected ..expected_type] (in (list g!temp (.` ({{.#Some (., g!temp)} diff --git a/stdlib/source/library/lux/meta/target/jvm/reflection.lux b/stdlib/source/library/lux/meta/target/jvm/reflection.lux index a9c4fc3ce..0ee71e599 100644 --- a/stdlib/source/library/lux/meta/target/jvm/reflection.lux +++ b/stdlib/source/library/lux/meta/target/jvm/reflection.lux @@ -290,7 +290,7 @@ (def .public (correspond class type) (-> (java/lang/Class java/lang/Object) Type (Try Mapping)) (case type - {.#Primitive (static array.type_name) (list :member:)} + {.#Primitive array.type_name (list :member:)} (if (java/lang/Class::isArray class) (correspond (java/lang/Class::getComponentType class) :member:) diff --git a/stdlib/source/library/lux/meta/type.lux b/stdlib/source/library/lux/meta/type.lux index f53222cf1..70181ea04 100644 --- a/stdlib/source/library/lux/meta/type.lux +++ b/stdlib/source/library/lux/meta/type.lux @@ -192,7 +192,7 @@ (and (text#= xname yname) (n.= (list.size yparams) (list.size xparams)) (list#mix (.function (_ [x y] prev) (and prev (= x y))) - #1 + true (list.zipped_2 xparams yparams))) (,, (with_template [] @@ -224,7 +224,7 @@ (and (n.= (list.size yenv) (list.size xenv)) (= xbody ybody) (list#mix (.function (_ [x y] prev) (and prev (= x y))) - #1 + true (list.zipped_2 xenv yenv)))] [.#UnivQ] @@ -232,7 +232,7 @@ )) _ - #0 + false )))))) (`` (def .public (applied params func) @@ -371,17 +371,17 @@ {.#Apply A F} (|> (..applied (list A) F) (at maybe.monad each quantified?) - (maybe.else #0)) + (maybe.else false)) (,, (with_template [] [ - #1] + true] [{.#UnivQ _}] [{.#ExQ _}])) _ - #0))) + false))) (def .public (array depth element_type) (-> Nat Type Type) diff --git a/stdlib/source/library/lux/meta/type/implicit.lux b/stdlib/source/library/lux/meta/type/implicit.lux index 64bcb5469..835fff931 100644 --- a/stdlib/source/library/lux/meta/type/implicit.lux +++ b/stdlib/source/library/lux/meta/type/implicit.lux @@ -320,7 +320,7 @@ #1 _ - #0)) + false)) (def (pair_list [l r]) (All (_ a) (-> [a a] (List a))) diff --git a/stdlib/source/library/lux/world/time/day.lux b/stdlib/source/library/lux/world/time/day.lux index 4f1570d43..5daf79ac0 100644 --- a/stdlib/source/library/lux/world/time/day.lux +++ b/stdlib/source/library/lux/world/time/day.lux @@ -37,7 +37,7 @@ (case [reference sample] (^.with_template [] [[{} {}] - #1]) + true]) ([#Sunday] [#Monday] [#Tuesday] @@ -47,18 +47,20 @@ [#Saturday]) _ - #0)))) + false)))) (def (nat day) (-> Day Nat) (case day - {#Sunday} 0 - {#Monday} 1 - {#Tuesday} 2 - {#Wednesday} 3 - {#Thursday} 4 - {#Friday} 5 - {#Saturday} 6)) + (^.with_template [ ] + [{} ]) + ([0 #Sunday] + [1 #Monday] + [2 #Tuesday] + [3 #Wednesday] + [4 #Thursday] + [5 #Friday] + [6 #Saturday]))) (def .public order (Order Day) -- cgit v1.2.3