diff options
Diffstat (limited to '')
112 files changed, 1951 insertions, 1860 deletions
diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux index 69656c4bc..b7053d6e9 100644 --- a/lux-js/source/program.lux +++ b/lux-js/source/program.lux @@ -177,14 +177,14 @@ (org/openjdk/nashorn/api/scripting/AbstractJSObject [] (getMember self [member java/lang/String]) java/lang/Object (case (ffi.of_string member) - (static runtime.i64_high_field) + runtime.i64_high_field (|> value .nat runtime.high jvm_int (ffi.is java/lang/Object)) - (static runtime.i64_low_field) + runtime.i64_low_field (|> value .nat runtime.low @@ -203,7 +203,7 @@ [] (org/openjdk/nashorn/api/scripting/AbstractJSObject [] (isFunction self []) boolean - (ffi.as_boolean #1)) + (ffi.as_boolean true)) (org/openjdk/nashorn/api/scripting/AbstractJSObject [] (call self [this java/lang/Object args [java/lang/Object]]) @@ -221,7 +221,7 @@ [] (org/openjdk/nashorn/api/scripting/AbstractJSObject [] (isFunction self []) boolean - (ffi.as_boolean #1)) + (ffi.as_boolean true)) (org/openjdk/nashorn/api/scripting/AbstractJSObject [] (call self [this java/lang/Object args [java/lang/Object]]) @@ -269,7 +269,7 @@ (org/openjdk/nashorn/api/scripting/AbstractJSObject [] (isArray self []) boolean - (ffi.as_boolean #1)) + (ffi.as_boolean true)) (org/openjdk/nashorn/api/scripting/AbstractJSObject [] (getMember self [member java/lang/String]) java/lang/Object @@ -288,12 +288,12 @@ (|> (::slice js_object value) (ffi.is java/lang/Object)) - (static runtime.variant_tag_field) + runtime.variant_tag_field (|> value (array.item 0) maybe.trusted) - (static runtime.variant_flag_field) + runtime.variant_flag_field (case (array.item 1 value) {.#Some set!} set! @@ -301,7 +301,7 @@ _ (ffi.null)) - (static runtime.variant_value_field) + runtime.variant_value_field (|> value (array.item 2) maybe.trusted diff --git a/lux-lua/source/program.lux b/lux-lua/source/program.lux index e1de9fdb0..a98f18507 100644 --- a/lux-lua/source/program.lux +++ b/lux-lua/source/program.lux @@ -398,7 +398,7 @@ (case (ffi.as net/sandius/rembulan/ByteString field) {.#Some field} (case (ffi.of_string (net/sandius/rembulan/ByteString::decode field)) - (static runtime.variant_tag_field) + runtime.variant_tag_field (case (array.item 0 value) {.#Some it} (|> it @@ -408,7 +408,7 @@ {.#None} (undefined)) - (static runtime.variant_flag_field) + runtime.variant_flag_field (case (array.item 1 value) {.#Some _} (as java/lang/Object "") @@ -416,7 +416,7 @@ {.#None} (ffi.null)) - (static runtime.variant_value_field) + runtime.variant_value_field (|> value (array.item 2) maybe.trusted diff --git a/lux-php/source/program.lux b/lux-php/source/program.lux index d3d191a8f..73c278858 100644 --- a/lux-php/source/program.lux +++ b/lux-php/source/program.lux @@ -279,14 +279,14 @@ index java/lang/String]) php/runtime/Memory (case (as Text index) - (static runtime.variant_tag_field) + runtime.variant_tag_field (|> value (array.read! 0) maybe.trusted (as java/lang/Integer) php/runtime/memory/LongMemory::valueOf) - (static runtime.variant_flag_field) + runtime.variant_flag_field (case (array.read! 1 value) {.#None} (php/runtime/memory/NullMemory::INSTANCE) @@ -294,13 +294,13 @@ {.#Some value} ..unit) - (static runtime.variant_value_field) + runtime.variant_value_field (|> value (array.read! 2) maybe.trusted (..value_wrapper lux_structure)) - (static runtime.tuple_size_field) + runtime.tuple_size_field (php/runtime/memory/LongMemory::new (array.size value)) _ diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux index 324d4cefc..6c541c74c 100644 --- a/lux-ruby/source/program.lux +++ b/lux-ruby/source/program.lux @@ -475,7 +475,7 @@ (case (ffi.as org/jruby/RubyString member) {.#Some member} (case (ffi.of_string (org/jruby/RubyString::asJavaString member)) - (static runtime.variant_tag_field) + runtime.variant_tag_field (|> value (array.item 0) maybe.trusted @@ -484,7 +484,7 @@ (org/jruby/RubyFixnum::new ..initial_ruby_runtime) (ffi.is org/jruby/runtime/builtin/IRubyObject)) - (static runtime.variant_flag_field) + runtime.variant_flag_field (case (array.item 1 value) {.#None} ..ruby_nil @@ -492,7 +492,7 @@ {.#Some flag} ..lux_unit) - (static runtime.variant_value_field) + runtime.variant_value_field (case (array.item 2 value) {.#Some value} (wrapped_lux_value (as_expected useful_object_class) lux_structure value) diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index 1ffc31a13..28350a7c9 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -371,10 +371,10 @@ ... (-> Weekday Bit) ... (case day ... (^or {#Saturday} {#Sunday}) - ... #1 + ... true ... _ - ... #0))]) + ... false))]) ($.definition /.let (format "Creates local bindings." @@ -720,7 +720,7 @@ ... \n "Useful in situations where the result of a branch depends on further refinements on the values being matched.") ... [(case (split (size static) uri) ... (^multi {#Some [chunk uri']} - ... [(text#= static chunk) #1]) + ... [(text#= static chunk) .true]) ... (match_uri endpoint? parts' uri') ... _ diff --git a/stdlib/source/documentation/lux/control.lux b/stdlib/source/documentation/lux/control.lux index 94b5981ee..0dd79c795 100644 --- a/stdlib/source/documentation/lux/control.lux +++ b/stdlib/source/documentation/lux/control.lux @@ -28,7 +28,7 @@ ["[1][0]" writer]]) (.def .public documentation - (.List $.Module) + (.List $.Documentation) (list.together (list /concatenative.documentation /concurrency.documentation diff --git a/stdlib/source/documentation/lux/control/concatenative.lux b/stdlib/source/documentation/lux/control/concatenative.lux index ec8a3ed74..1a1f06dfa 100644 --- a/stdlib/source/documentation/lux/control/concatenative.lux +++ b/stdlib/source/documentation/lux/control/concatenative.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop left right) + [lux (.except) ["$" documentation] [data [text @@ -17,180 +17,181 @@ [\\library ["[0]" /]]) -(`` (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.value) - - ($.definition /.=> - "Concatenative function types." - [(=> [Nat] [Nat])] - [(All (_ a) - (-> a (=> [] [a])))] - [(All (_ t) - (=> [t] []))] - [(All (_ a b c) - (=> [a b c] [b c a]))] - [(All (_ ,,,0 ,,,1) - (=> [then (=> ,,,0 ,,,1) - else (=> ,,,0 ,,,1)] - ,,,0 [Bit then else] ,,,1))]) - - ($.definition /.apply - "A generator for functions that turn arity N functions into arity N concatenative functions." - [(is (=> [Nat] [Nat]) - ((apply 1) ++))]) - - (,, (with_template [<arity>] - [(with_expansions [<name> (template.symbol [/._] ["apply_" <arity>]) - <doc> (template.text ["Lift a function of arity " <arity> - " into a concatenative function of arity " <arity> "."])] - ($.definition <name> - <doc>))] - - [1] [2] [3] [4] - [5] [6] [7] [8] - )) - - ($.definition /.push - "Push a value onto the stack.") - - ($.definition /.drop - "Drop/pop a value from the top of the stack.") - - ($.definition /.nip - "Drop the second-to-last value from the top of the stack.") - - ($.definition /.dup - "Duplicate the top of the stack.") - - ($.definition /.swap - "Swaps the 2 topmost stack values.") - - ($.definition /.left_rotation - "Rotes the 3 topmost stack values to the left.") - - ($.definition /.right_rotation - "Rotes the 3 topmost stack values to the right.") - - ($.definition /.&& - "Groups the 2 topmost stack values as a 2-tuple.") - - ($.definition /.left - "Left-injects the top into sum.") - - ($.definition /.right - "Right-injects the top into sum.") - - (,, (with_template [<input> <word> <func>] - [(`` ($.definition (,, (template.symbol [/._] [<word>])) - (,, (template.text [<func> " for " <input> " arithmetic."]))))] - - [Nat n/+ n.+] - [Nat n/- n.-] - [Nat n/* n.*] - [Nat n// n./] - [Nat n/% n.%] - [Nat n/= n.=] - [Nat n/< n.<] - [Nat n/<= n.<=] - [Nat n/> n.>] - [Nat n/>= n.>=] - - [Int i/+ i.+] - [Int i/- i.-] - [Int i/* i.*] - [Int i// i./] - [Int i/% i.%] - [Int i/= i.=] - [Int i/< i.<] - [Int i/<= i.<=] - [Int i/> i.>] - [Int i/>= i.>=] - - [Rev r/+ r.+] - [Rev r/- r.-] - [Rev r/* r.*] - [Rev r// r./] - [Rev r/% r.%] - [Rev r/= r.=] - [Rev r/< r.<] - [Rev r/<= r.<=] - [Rev r/> r.>] - [Rev r/>= r.>=] - - [Frac f/+ f.+] - [Frac f/- f.-] - [Frac f/* f.*] - [Frac f// f./] - [Frac f/% f.%] - [Frac f/= f.=] - [Frac f/< f.<] - [Frac f/<= f.<=] - [Frac f/> f.>] - [Frac f/>= f.>=] - )) - - ($.definition /.if - "If expression." - [(same? "then" - (/.value (|>> (push true) - (push "then") - (push "else") - if)))]) - - ($.definition /.call - "Executes an anonymous block on the stack.") - - ($.definition /.loop - "Executes a block as a loop until it yields #0 to stop.") - - ($.definition /.dip - "Executes a block on the stack, save for the topmost value.") - - ($.definition /.dip_2 - "Executes a block on the stack, save for the 2 topmost values.") - - ($.definition /.do - "Do-while loop expression." - [(n.= (++ sample) - (/.value (|>> (push sample) - (push (push false)) - (push (|>> (push 1) n/+)) - do while)))]) - - ($.definition /.while - "While loop expression." - [(n.= (n.+ distance start) - (/.value (|>> (push start) - (push (|>> dup - (push start) n/- - (push distance) n/<)) - (push (|>> (push 1) n/+)) - while)))]) - - ($.definition /.compose - "Function composition." - [(n.= (n.+ 2 sample) - (/.value (|>> (push sample) - (push (|>> (push 1) n/+)) - (push (|>> (push 1) n/+)) - compose - call)))]) - - ($.definition /.partial - "Partial application." - [(n.= (n.+ sample sample) - (/.value (|>> (push sample) - (push sample) - (push n/+) - partial - call)))]) - - ($.definition /.when - "Only execute the block when #1.") - - ($.definition /.? - "Choose the top value when #0 and the second-to-top when #1.")] - []))) +(`` (def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.value) + + ($.definition /.=> + "Concatenative function types." + [(=> [Nat] [Nat])] + [(All (_ a) + (-> a (=> [] [a])))] + [(All (_ t) + (=> [t] []))] + [(All (_ a b c) + (=> [a b c] [b c a]))] + [(All (_ ,,,0 ,,,1) + (=> [then (=> ,,,0 ,,,1) + else (=> ,,,0 ,,,1)] + ,,,0 [Bit then else] ,,,1))]) + + ($.definition /.apply + "A generator for functions that turn arity N functions into arity N concatenative functions." + [(is (=> [Nat] [Nat]) + ((apply 1) ++))]) + + (,, (with_template [<arity>] + [(with_expansions [<name> (template.symbol [/._] ["apply_" <arity>]) + <doc> (template.text ["Lift a function of arity " <arity> + " into a concatenative function of arity " <arity> "."])] + ($.definition <name> + <doc>))] + + [1] [2] [3] [4] + [5] [6] [7] [8] + )) + + ($.definition /.push + "Push a value onto the stack.") + + ($.definition /.drop + "Drop/pop a value from the top of the stack.") + + ($.definition /.nip + "Drop the second-to-last value from the top of the stack.") + + ($.definition /.dup + "Duplicate the top of the stack.") + + ($.definition /.swap + "Swaps the 2 topmost stack values.") + + ($.definition /.left_rotation + "Rotes the 3 topmost stack values to the left.") + + ($.definition /.right_rotation + "Rotes the 3 topmost stack values to the right.") + + ($.definition /.&& + "Groups the 2 topmost stack values as a 2-tuple.") + + ($.definition /.left + "Left-injects the top into sum.") + + ($.definition /.right + "Right-injects the top into sum.") + + (,, (with_template [<input> <word> <func>] + [(`` ($.definition (,, (template.symbol [/._] [<word>])) + (,, (template.text [<func> " for " <input> " arithmetic."]))))] + + [Nat n/+ n.+] + [Nat n/- n.-] + [Nat n/* n.*] + [Nat n// n./] + [Nat n/% n.%] + [Nat n/= n.=] + [Nat n/< n.<] + [Nat n/<= n.<=] + [Nat n/> n.>] + [Nat n/>= n.>=] + + [Int i/+ i.+] + [Int i/- i.-] + [Int i/* i.*] + [Int i// i./] + [Int i/% i.%] + [Int i/= i.=] + [Int i/< i.<] + [Int i/<= i.<=] + [Int i/> i.>] + [Int i/>= i.>=] + + [Rev r/+ r.+] + [Rev r/- r.-] + [Rev r/* r.*] + [Rev r// r./] + [Rev r/% r.%] + [Rev r/= r.=] + [Rev r/< r.<] + [Rev r/<= r.<=] + [Rev r/> r.>] + [Rev r/>= r.>=] + + [Frac f/+ f.+] + [Frac f/- f.-] + [Frac f/* f.*] + [Frac f// f./] + [Frac f/% f.%] + [Frac f/= f.=] + [Frac f/< f.<] + [Frac f/<= f.<=] + [Frac f/> f.>] + [Frac f/>= f.>=] + )) + + ($.definition /.if + "If expression." + [(same? "then" + (/.value (|>> (push true) + (push "then") + (push "else") + if)))]) + + ($.definition /.call + "Executes an anonymous block on the stack.") + + ($.definition /.loop + "Executes a block as a loop until it yields #0 to stop.") + + ($.definition /.dip + "Executes a block on the stack, save for the topmost value.") + + ($.definition /.dip_2 + "Executes a block on the stack, save for the 2 topmost values.") + + ($.definition /.do + "Do-while loop expression." + [(n.= (++ sample) + (/.value (|>> (push sample) + (push (push false)) + (push (|>> (push 1) n/+)) + do while)))]) + + ($.definition /.while + "While loop expression." + [(n.= (n.+ distance start) + (/.value (|>> (push start) + (push (|>> dup + (push start) n/- + (push distance) n/<)) + (push (|>> (push 1) n/+)) + while)))]) + + ($.definition /.compose + "Function composition." + [(n.= (n.+ 2 sample) + (/.value (|>> (push sample) + (push (|>> (push 1) n/+)) + (push (|>> (push 1) n/+)) + compose + call)))]) + + ($.definition /.partial + "Partial application." + [(n.= (n.+ sample sample) + (/.value (|>> (push sample) + (push sample) + (push n/+) + partial + call)))]) + + ($.definition /.when + "Only execute the block when #1.") + + ($.definition /.? + "Choose the top value when #0 and the second-to-top when #1.") + ))) diff --git a/stdlib/source/documentation/lux/control/concurrency.lux b/stdlib/source/documentation/lux/control/concurrency.lux index 3a464a384..7bfd1436b 100644 --- a/stdlib/source/documentation/lux/control/concurrency.lux +++ b/stdlib/source/documentation/lux/control/concurrency.lux @@ -17,7 +17,7 @@ ["[1][0]" thread]]) (.def .public documentation - (.List $.Module) + (.List $.Documentation) (list.together (list /actor.documentation /async.documentation diff --git a/stdlib/source/documentation/lux/control/concurrency/actor.lux b/stdlib/source/documentation/lux/control/concurrency/actor.lux index ab412a640..1d4fa276f 100644 --- a/stdlib/source/documentation/lux/control/concurrency/actor.lux +++ b/stdlib/source/documentation/lux/control/concurrency/actor.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,54 +8,55 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "The actor model of concurrency." - [($.definition /.poisoned) - ($.definition /.dead) - ($.definition /.alive?) - ($.definition /.obituary') +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "The actor model of concurrency.") - ($.definition (/.Actor state) - "An entity that can react to messages (mail) sent to it concurrently.") + ($.definition /.poisoned) + ($.definition /.dead) + ($.definition /.alive?) + ($.definition /.obituary') - ($.definition (/.Mail state) - "A one-way message sent to an actor, without expecting a reply.") + ($.definition (/.Actor state) + "An entity that can react to messages (mail) sent to it concurrently.") - ($.definition (/.Obituary state) - "Details on the death of an actor.") + ($.definition (/.Mail state) + "A one-way message sent to an actor, without expecting a reply.") - ($.definition (/.Behavior state) - "An actor's behavior when mail is received.") + ($.definition (/.Obituary state) + "Details on the death of an actor.") - ($.definition /.spawn! - "Given a behavior and initial state, spawns an actor and returns it.") + ($.definition (/.Behavior state) + "An actor's behavior when mail is received.") - ($.definition /.obituary - "Await for an actor to stop working.") + ($.definition /.spawn! + "Given a behavior and initial state, spawns an actor and returns it.") - ($.definition /.mail! - "Send mail to an actor.") + ($.definition /.obituary + "Await for an actor to stop working.") - ($.definition (/.Message state output) - "A two-way message sent to an actor, expecting a reply.") + ($.definition /.mail! + "Send mail to an actor.") - ($.definition /.tell! - "Communicate with an actor through message-passing.") + ($.definition (/.Message state output) + "A two-way message sent to an actor, expecting a reply.") - ($.definition /.default - "Default actor behavior.") + ($.definition /.tell! + "Communicate with an actor through message-passing.") - ($.definition /.poison! - (format "Kills the actor by sending mail that will kill it upon processing," - \n "but allows the actor to handle previous mail.")) + ($.definition /.default + "Default actor behavior.") - ($.definition /.Stop - "A signal to stop an actor from observing a channel.") + ($.definition /.poison! + (format "Kills the actor by sending mail that will kill it upon processing," + \n "but allows the actor to handle previous mail.")) - ($.definition /.observe! - (format "Use an actor to observe a channel by transforming each datum" - \n "flowing through the channel into mail the actor can process." - \n "Can stop observing the channel by executing the Stop value."))] - [])) + ($.definition /.Stop + "A signal to stop an actor from observing a channel.") + + ($.definition /.observe! + (format "Use an actor to observe a channel by transforming each datum" + \n "flowing through the channel into mail the actor can process." + \n "Can stop observing the channel by executing the Stop value.")) + )) diff --git a/stdlib/source/documentation/lux/control/concurrency/async.lux b/stdlib/source/documentation/lux/control/concurrency/async.lux index 02d407203..f05e501b0 100644 --- a/stdlib/source/documentation/lux/control/concurrency/async.lux +++ b/stdlib/source/documentation/lux/control/concurrency/async.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except or and) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,72 +8,73 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - - ($.definition (/.Async it) - "Represents values produced by asynchronous computations (unlike IO, which is synchronous).") - - ($.definition (/.Resolver it) - (format "The function used to give a value to an async." - \n "Will signal 'true' if the async has been resolved for the 1st time, 'false' otherwise.")) - - ($.definition /.resolved - "Produces an async that has already been resolved to the given value." - [(resolved value)]) - - ($.definition /.async - "Creates a fresh async that has not been resolved yet." - [(async _)]) - - ($.definition /.value - "Polls an async for its value.") - - ($.definition /.upon! - "Executes the given function as soon as the async has been resolved." - [(upon! function async)]) - - ($.definition /.resolved? - "Checks whether an async's value has already been resolved.") - - ($.definition /.and - "Combines the results of both asyncs, in-order." - [(and left right)]) - - ($.definition /.or - (format "Yields the results of whichever async gets resolved first." - \n "You can tell which one was resolved first through pattern-matching.") - [(or left right)]) - - ($.definition /.either - (format "Yields the results of whichever async gets resolved first." - \n "You cannot tell which one was resolved first.") - [(either left right)]) - - ($.definition /.schedule! - (format "Runs an I/O computation on its own thread (after a specified delay)." - \n "Returns an async that will eventually host its result.") - [(schedule! milli_seconds computation)]) - - ($.definition /.future - (format "Runs an I/O computation on its own thread." - \n "Returns an async that will eventually host its result.") - [(future computation)]) - - ($.definition /.after - "Delivers a value after a certain period has passed." - [(after milli_seconds value)]) - - ($.definition /.delay - "An async that will be resolved after the specified amount of milli-seconds." - [(delay milli_seconds)]) - - ($.definition /.within - "Wait for an async to be resolved within the specified amount of milli-seconds." - [(within milli_seconds async)])] - [])) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + + ($.definition (/.Async it) + "Represents values produced by asynchronous computations (unlike IO, which is synchronous).") + + ($.definition (/.Resolver it) + (format "The function used to give a value to an async." + \n "Will signal 'true' if the async has been resolved for the 1st time, 'false' otherwise.")) + + ($.definition /.resolved + "Produces an async that has already been resolved to the given value." + [(resolved value)]) + + ($.definition /.async + "Creates a fresh async that has not been resolved yet." + [(async _)]) + + ($.definition /.value + "Polls an async for its value.") + + ($.definition /.upon! + "Executes the given function as soon as the async has been resolved." + [(upon! function async)]) + + ($.definition /.resolved? + "Checks whether an async's value has already been resolved.") + + ($.definition /.and + "Combines the results of both asyncs, in-order." + [(and left right)]) + + ($.definition /.or + (format "Yields the results of whichever async gets resolved first." + \n "You can tell which one was resolved first through pattern-matching.") + [(or left right)]) + + ($.definition /.either + (format "Yields the results of whichever async gets resolved first." + \n "You cannot tell which one was resolved first.") + [(either left right)]) + + ($.definition /.schedule! + (format "Runs an I/O computation on its own thread (after a specified delay)." + \n "Returns an async that will eventually host its result.") + [(schedule! milli_seconds computation)]) + + ($.definition /.future + (format "Runs an I/O computation on its own thread." + \n "Returns an async that will eventually host its result.") + [(future computation)]) + + ($.definition /.after + "Delivers a value after a certain period has passed." + [(after milli_seconds value)]) + + ($.definition /.delay + "An async that will be resolved after the specified amount of milli-seconds." + [(delay milli_seconds)]) + + ($.definition /.within + "Wait for an async to be resolved within the specified amount of milli-seconds." + [(within milli_seconds async)]) + )) diff --git a/stdlib/source/documentation/lux/control/concurrency/atom.lux b/stdlib/source/documentation/lux/control/concurrency/atom.lux index 188d52f48..30f7cfa8d 100644 --- a/stdlib/source/documentation/lux/control/concurrency/atom.lux +++ b/stdlib/source/documentation/lux/control/concurrency/atom.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,26 +8,27 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.atom) - ($.definition /.read!) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Atom it) - "Atomic references that are safe to mutate concurrently.") + ($.definition /.atom) + ($.definition /.read!) - ($.definition /.compare_and_swap! - (format "Only mutates an atom if you can present its current value." - \n "That guarantees that atom was not updated since you last read from it.")) + ($.definition (/.Atom it) + "Atomic references that are safe to mutate concurrently.") - ($.definition /.update! - (format "Updates an atom by applying a function to its current value." - \n "If it fails to update it (because some other process wrote to it first), it will retry until it succeeds." - \n "The retries will be done with the new values of the atom, as they show up.")) + ($.definition /.compare_and_swap! + (format "Only mutates an atom if you can present its current value." + \n "That guarantees that atom was not updated since you last read from it.")) - ($.definition /.write! - (format "Writes the given value to an atom." - \n "If it fails to write it (because some other process wrote to it first), it will retry until it succeeds."))] - [])) + ($.definition /.update! + (format "Updates an atom by applying a function to its current value." + \n "If it fails to update it (because some other process wrote to it first), it will retry until it succeeds." + \n "The retries will be done with the new values of the atom, as they show up.")) + + ($.definition /.write! + (format "Writes the given value to an atom." + \n "If it fails to write it (because some other process wrote to it first), it will retry until it succeeds.")) + )) diff --git a/stdlib/source/documentation/lux/control/concurrency/frp.lux b/stdlib/source/documentation/lux/control/concurrency/frp.lux index c2e543372..f22587e37 100644 --- a/stdlib/source/documentation/lux/control/concurrency/frp.lux +++ b/stdlib/source/documentation/lux/control/concurrency/frp.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,49 +8,50 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.already_closed) - ($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - ($.definition /.subscribe!) - ($.definition /.mixes) - ($.definition /.poll) - ($.definition /.periodic) - ($.definition /.iterations) - ($.definition /.distinct) - ($.definition /.list) - - ($.definition (/.Channel it) - "An asynchronous channel to distribute values.") - - ($.definition (/.Sink it) - "The tail-end of a channel, which can be written-to to fee the channel.") - - ($.definition /.channel - "Creates a brand-new channel and hands it over, along with the sink to write to it." - [(channel _)]) - - ($.definition (/.Subscriber it) - "A function that can receive every value fed into a channel.") - - ($.definition /.only - (format "Produces a new channel based on the old one, only with values" - \n "that pass the test.") - [(only pass? channel)]) - - ($.definition /.of_async - "A one-element channel containing the output from an async." - [(of_async async)]) - - ($.definition /.mix - "Asynchronous mix over channels." - [(mix f init channel)]) - - ($.definition /.sequential - "Transforms the given list into a channel with the same elements." - [(sequential milli_seconds values)])] - [])) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.already_closed) + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + ($.definition /.subscribe!) + ($.definition /.mixes) + ($.definition /.poll) + ($.definition /.periodic) + ($.definition /.iterations) + ($.definition /.distinct) + ($.definition /.list) + + ($.definition (/.Channel it) + "An asynchronous channel to distribute values.") + + ($.definition (/.Sink it) + "The tail-end of a channel, which can be written-to to fee the channel.") + + ($.definition /.channel + "Creates a brand-new channel and hands it over, along with the sink to write to it." + [(channel _)]) + + ($.definition (/.Subscriber it) + "A function that can receive every value fed into a channel.") + + ($.definition /.only + (format "Produces a new channel based on the old one, only with values" + \n "that pass the test.") + [(only pass? channel)]) + + ($.definition /.of_async + "A one-element channel containing the output from an async." + [(of_async async)]) + + ($.definition /.mix + "Asynchronous mix over channels." + [(mix f init channel)]) + + ($.definition /.sequential + "Transforms the given list into a channel with the same elements." + [(sequential milli_seconds values)]) + )) diff --git a/stdlib/source/documentation/lux/control/concurrency/semaphore.lux b/stdlib/source/documentation/lux/control/concurrency/semaphore.lux index 556406f4d..757bb8692 100644 --- a/stdlib/source/documentation/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/documentation/lux/control/concurrency/semaphore.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,49 +8,50 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.semaphore_is_maxed_out) - ($.definition /.barrier) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition /.Semaphore - "A tool for controlling access to resources by multiple concurrent processes.") + ($.definition /.semaphore_is_maxed_out) + ($.definition /.barrier) - ($.definition /.semaphore - "" - [(semaphore initial_open_positions)]) + ($.definition /.Semaphore + "A tool for controlling access to resources by multiple concurrent processes.") - ($.definition /.wait! - (format "Wait on a semaphore until there are open positions." - \n "After finishing your work, you must 'signal' to the semaphore that you're done.") - [(wait! semaphore)]) + ($.definition /.semaphore + "" + [(semaphore initial_open_positions)]) - ($.definition /.signal! - "Signal to a semaphore that you're done with your work, and that there is a new open position." - [(signal! semaphore)]) + ($.definition /.wait! + (format "Wait on a semaphore until there are open positions." + \n "After finishing your work, you must 'signal' to the semaphore that you're done.") + [(wait! semaphore)]) - ($.definition /.Mutex - "A mutual-exclusion lock that can only be acquired by one process at a time.") + ($.definition /.signal! + "Signal to a semaphore that you're done with your work, and that there is a new open position." + [(signal! semaphore)]) - ($.definition /.mutex - "Creates a brand-new mutex." - [(mutex _)]) + ($.definition /.Mutex + "A mutual-exclusion lock that can only be acquired by one process at a time.") - ($.definition /.synchronize! - "Runs the procedure with exclusive control of the mutex." - [(synchronize! mutex procedure)]) + ($.definition /.mutex + "Creates a brand-new mutex." + [(mutex _)]) - ($.definition /.limit - "Produce a limit for a barrier.") + ($.definition /.synchronize! + "Runs the procedure with exclusive control of the mutex." + [(synchronize! mutex procedure)]) - ($.definition /.Limit - "A limit for barriers.") + ($.definition /.limit + "Produce a limit for a barrier.") - ($.definition /.Barrier - "A barrier that blocks all processes from proceeding until a given number of processes are parked at the barrier.") + ($.definition /.Limit + "A limit for barriers.") - ($.definition /.block! - "Wait on a barrier until all processes have arrived and met the barrier's limit.")] - [])) + ($.definition /.Barrier + "A barrier that blocks all processes from proceeding until a given number of processes are parked at the barrier.") + + ($.definition /.block! + "Wait on a barrier until all processes have arrived and met the barrier's limit.") + )) diff --git a/stdlib/source/documentation/lux/control/concurrency/stm.lux b/stdlib/source/documentation/lux/control/concurrency/stm.lux index fb4438584..afa5e4744 100644 --- a/stdlib/source/documentation/lux/control/concurrency/stm.lux +++ b/stdlib/source/documentation/lux/control/concurrency/stm.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,36 +9,37 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.read) - ($.definition /.write) - ($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - - ($.definition (/.Var it) - "A mutable cell containing a value, and observers that will be alerted of any change to it.") - - ($.definition /.var - "Creates a new STM var, with a default value." - [(var value)]) - - ($.definition /.changes - "Creates a channel that will receive all changes to the value of the given var." - [(changes target)]) - - ($.definition (/.STM it) - "A computation which updates a transaction and produces a value.") - - ($.definition /.update - "Update a var's value, and return a tuple with the old and the new values." - [(update function var)]) - - ($.definition /.commit! - (format "Commits a transaction and returns its result (asynchronously)." - \n "Note that a transaction may be re-run an indeterminate number of times if other transactions involving the same variables successfully commit first." - \n "For this reason, it's important to note that transactions must be free from side-effects, such as I/O.") - [(commit! procedure)])] - [])) + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.read) + ($.definition /.write) + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + + ($.definition (/.Var it) + "A mutable cell containing a value, and observers that will be alerted of any change to it.") + + ($.definition /.var + "Creates a new STM var, with a default value." + [(var value)]) + + ($.definition /.changes + "Creates a channel that will receive all changes to the value of the given var." + [(changes target)]) + + ($.definition (/.STM it) + "A computation which updates a transaction and produces a value.") + + ($.definition /.update + "Update a var's value, and return a tuple with the old and the new values." + [(update function var)]) + + ($.definition /.commit! + (format "Commits a transaction and returns its result (asynchronously)." + \n "Note that a transaction may be re-run an indeterminate number of times if other transactions involving the same variables successfully commit first." + \n "For this reason, it's important to note that transactions must be free from side-effects, such as I/O.") + [(commit! procedure)]) + )) diff --git a/stdlib/source/documentation/lux/control/concurrency/thread.lux b/stdlib/source/documentation/lux/control/concurrency/thread.lux index e4ed65586..ec9e89ee1 100644 --- a/stdlib/source/documentation/lux/control/concurrency/thread.lux +++ b/stdlib/source/documentation/lux/control/concurrency/thread.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,13 +9,14 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.parallelism - "How many processes can run in parallel.") + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition /.schedule! - "Executes an I/O procedure after some milli-seconds." - [(schedule! milli_seconds action)])] - [])) + ($.definition /.parallelism + "How many processes can run in parallel.") + + ($.definition /.schedule! + "Executes an I/O procedure after some milli-seconds." + [(schedule! milli_seconds action)]) + )) diff --git a/stdlib/source/documentation/lux/control/continuation.lux b/stdlib/source/documentation/lux/control/continuation.lux index 4279293de..c1baa45bd 100644 --- a/stdlib/source/documentation/lux/control/continuation.lux +++ b/stdlib/source/documentation/lux/control/continuation.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,38 +9,39 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.reset) - ($.definition /.shift) - ($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - ($.definition /.portal) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Cont input output) - "Continuations.") + ($.definition /.reset) + ($.definition /.shift) + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + ($.definition /.portal) - ($.definition /.continued - "Continues a continuation thunk." - [(continued next cont)]) + ($.definition (/.Cont input output) + "Continuations.") - ($.definition /.result - "Forces a continuation thunk to be evaluated." - [(result cont)]) + ($.definition /.continued + "Continues a continuation thunk." + [(continued next cont)]) - ($.definition /.with_current - "Call with current continuation." - [(with_current - (function (_ go) - (do /.monad - [.let [nexus (function (nexus val) - (go [nexus val]))] - _ (go [nexus init])] - (in (undefined)))))]) + ($.definition /.result + "Forces a continuation thunk to be evaluated." + [(result cont)]) - ($.definition /.pending - "Turns any expression into a function that is pending a continuation." - [(pending (some_function some_input))])] - [])) + ($.definition /.with_current + "Call with current continuation." + [(with_current + (function (_ go) + (do /.monad + [.let [nexus (function (nexus val) + (go [nexus val]))] + _ (go [nexus init])] + (in (undefined)))))]) + + ($.definition /.pending + "Turns any expression into a function that is pending a continuation." + [(pending (some_function some_input))]) + )) diff --git a/stdlib/source/documentation/lux/control/exception.lux b/stdlib/source/documentation/lux/control/exception.lux index 6db7ad8e9..6d0bbc2dd 100644 --- a/stdlib/source/documentation/lux/control/exception.lux +++ b/stdlib/source/documentation/lux/control/exception.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,59 +9,60 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "Pure-Lux exception-handling functionality." - [($.definition /.assertion) + (.List $.Documentation) + (list ($.module /._ + "Pure-Lux exception-handling functionality.") - ($.definition (/.Exception it) - "An exception provides a way to decorate error messages.") + ($.definition /.assertion) - ($.definition /.match? - "Is this exception the cause of the error message?" - [(match? exception error)]) + ($.definition (/.Exception it) + "An exception provides a way to decorate error messages.") - ($.definition /.when - (format "If a particular exception is detected on a possibly-erroneous value, handle it." - \n "If no exception was detected, or a different one from the one being checked, then pass along the original value.") - [(when exception then try)]) + ($.definition /.match? + "Is this exception the cause of the error message?" + [(match? exception error)]) - ($.definition /.otherwise - "If no handler could be found to catch the exception, then run a function as a last-resort measure." - [(otherwise else try)]) + ($.definition /.when + (format "If a particular exception is detected on a possibly-erroneous value, handle it." + \n "If no exception was detected, or a different one from the one being checked, then pass along the original value.") + [(when exception then try)]) - ($.definition /.error - "Constructs an error message from an exception." - [(error exception message)]) + ($.definition /.otherwise + "If no handler could be found to catch the exception, then run a function as a last-resort measure." + [(otherwise else try)]) - ($.definition /.except - "Decorate an error message with an Exception and lift it into the error-handling context." - [(except exception message)]) + ($.definition /.error + "Constructs an error message from an exception." + [(error exception message)]) - ($.definition /.exception - (format "Define a new exception type." - \n "It mostly just serves as a way to tag error messages for later catching.") - ["Simple case:" - (exception .public some_exception)] - ["Complex case:" - (exception .public [arbitrary type variables] (some_exception [optional Text - arguments Int]) - optional_body)]) + ($.definition /.except + "Decorate an error message with an Exception and lift it into the error-handling context." + [(except exception message)]) - ($.definition /.report - "An error report." - [(is Text - (report (list ["Row 0" value/0] - ["Row 1" value/1] - ,,, - ["Row N" value/N])))]) + ($.definition /.exception + (format "Define a new exception type." + \n "It mostly just serves as a way to tag error messages for later catching.") + ["Simple case:" + (exception .public some_exception)] + ["Complex case:" + (exception .public [arbitrary type variables] (some_exception [optional Text + arguments Int]) + optional_body)]) - ($.definition /.listing - (format "A numbered report of the entries on a list." - \n "NOTE: 0-based numbering.") - [(listing format entries)]) + ($.definition /.report + "An error report." + [(is Text + (report (list ["Row 0" value/0] + ["Row 1" value/1] + ,,, + ["Row N" value/N])))]) - ($.definition /.with - "If a computation fails, prepends the exception to the error." - [(with exception message computation)])] - [])) + ($.definition /.listing + (format "A numbered report of the entries on a list." + \n "NOTE: 0-based numbering.") + [(listing format entries)]) + + ($.definition /.with + "If a computation fails, prepends the exception to the error." + [(with exception message computation)]) + )) diff --git a/stdlib/source/documentation/lux/control/function.lux b/stdlib/source/documentation/lux/control/function.lux index ce4b51519..237844ab2 100644 --- a/stdlib/source/documentation/lux/control/function.lux +++ b/stdlib/source/documentation/lux/control/function.lux @@ -4,7 +4,9 @@ ["$" documentation] [data [text (.only \n) - ["%" \\format (.only format)]]]]] + ["%" \\format (.only format)]] + [collection + ["[0]" list (.use "[1]#[0]" monoid)]]]]] [\\library ["[0]" /]] ["[0]" / @@ -15,37 +17,41 @@ ["[1][0]" predicate]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.monoid) - - ($.definition /.identity - (format "Identity function." - \n "Does nothing to its argument and just returns it.") - [(same? (identity value) - value)]) - - ($.definition /.composite - "Function composition." - [(= ((composite f g) "foo") - (f (g "foo")))]) - - ($.definition /.constant - "Create constant functions." - [(= ((constant "foo") "bar") - "foo")]) - - ($.definition /.flipped - "Flips the order of the arguments of a function." - [(= ((flipped f) "foo" "bar") - (f "bar" "foo"))]) - - ($.definition /.on - "Simple 1-argument function application." - [(on input function)])] - [/contract.documentation - /memo.documentation - /mixin.documentation - /mutual.documentation - /predicate.documentation])) + (.List $.Documentation) + (list.partial ($.module /._ + "") + + ($.definition /.monoid) + + ($.definition /.identity + (format "Identity function." + \n "Does nothing to its argument and just returns it.") + [(same? (identity value) + value)]) + + ($.definition /.composite + "Function composition." + [(= ((composite f g) "foo") + (f (g "foo")))]) + + ($.definition /.constant + "Create constant functions." + [(= ((constant "foo") "bar") + "foo")]) + + ($.definition /.flipped + "Flips the order of the arguments of a function." + [(= ((flipped f) "foo" "bar") + (f "bar" "foo"))]) + + ($.definition /.on + "Simple 1-argument function application." + [(on input function)]) + + (all list#composite + /contract.documentation + /memo.documentation + /mixin.documentation + /mutual.documentation + /predicate.documentation) + )) diff --git a/stdlib/source/documentation/lux/control/function/contract.lux b/stdlib/source/documentation/lux/control/function/contract.lux index ea946a3fa..ad91f818d 100644 --- a/stdlib/source/documentation/lux/control/function/contract.lux +++ b/stdlib/source/documentation/lux/control/function/contract.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,24 +9,25 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.pre_condition_failed) - ($.definition /.post_condition_failed) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition /.pre - (format "Pre-conditions." - \n "Given a test and an expression to run, only runs the expression if the test passes." - \n "Otherwise, an error is raised.") - [(pre (i.= +4 (i.+ +2 +2)) - (foo +123 +456 +789))]) + ($.definition /.pre_condition_failed) + ($.definition /.post_condition_failed) - ($.definition /.post - (format "Post-conditions." - \n "Given a predicate and an expression to run, evaluates the expression and then tests the output with the predicate." - \n "If the predicate returns #1, returns the value of the expression." - \n "Otherwise, an error is raised.") - [(post i.even? - (i.+ +2 +2))])] - [])) + ($.definition /.pre + (format "Pre-conditions." + \n "Given a test and an expression to run, only runs the expression if the test passes." + \n "Otherwise, an error is raised.") + [(pre (i.= +4 (i.+ +2 +2)) + (foo +123 +456 +789))]) + + ($.definition /.post + (format "Post-conditions." + \n "Given a predicate and an expression to run, evaluates the expression and then tests the output with the predicate." + \n "If the predicate returns #1, returns the value of the expression." + \n "Otherwise, an error is raised.") + [(post i.even? + (i.+ +2 +2))]) + )) diff --git a/stdlib/source/documentation/lux/control/function/memo.lux b/stdlib/source/documentation/lux/control/function/memo.lux index 0633cff02..dcbda3a2d 100644 --- a/stdlib/source/documentation/lux/control/function/memo.lux +++ b/stdlib/source/documentation/lux/control/function/memo.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except open) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,23 +9,24 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.memoization) - ($.definition (/.Memo input output)) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition /.open - "Memoization where the memoized results can be re-used accross invocations." - [(open memo)]) + ($.definition /.memoization) + ($.definition (/.Memo input output)) - ($.definition /.closed - (format "Memoization confined to a single invocation to the function (not counting any subsequent recursive invocations)." - \n "Memoized results will be re-used during recursive invocations, but cannot be accessed after the main invocation has ended.") - [(closed hash memo)]) + ($.definition /.open + "Memoization where the memoized results can be re-used accross invocations." + [(open memo)]) - ($.definition /.none - (format "No memoization at all." - \n "This is useful as a test control when measuring the effect of using memoization.") - [(none hash memo)])] - [])) + ($.definition /.closed + (format "Memoization confined to a single invocation to the function (not counting any subsequent recursive invocations)." + \n "Memoized results will be re-used during recursive invocations, but cannot be accessed after the main invocation has ended.") + [(closed hash memo)]) + + ($.definition /.none + (format "No memoization at all." + \n "This is useful as a test control when measuring the effect of using memoization.") + [(none hash memo)]) + )) diff --git a/stdlib/source/documentation/lux/control/function/mixin.lux b/stdlib/source/documentation/lux/control/function/mixin.lux index 7444f1114..9ed15bf09 100644 --- a/stdlib/source/documentation/lux/control/function/mixin.lux +++ b/stdlib/source/documentation/lux/control/function/mixin.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,42 +8,43 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.monoid) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Mixin input output) - "A partially-defined function which can be mixed with others to inherit their behavior.") + ($.definition /.monoid) - ($.definition /.fixed - "Given a mixin, produces a normal function." - [(fixed f)]) + ($.definition (/.Mixin input output) + "A partially-defined function which can be mixed with others to inherit their behavior.") - ($.definition /.nothing - "A mixin that does nothing and just delegates work to the next mixin.") + ($.definition /.fixed + "Given a mixin, produces a normal function." + [(fixed f)]) - ($.definition /.mixed - "Produces a new mixin, where the behavior of the child can make use of the behavior of the parent." - [(mixed parent child)]) + ($.definition /.nothing + "A mixin that does nothing and just delegates work to the next mixin.") - ($.definition /.advice - "Only apply then mixin when the input meets some criterion." - [(advice when then)]) + ($.definition /.mixed + "Produces a new mixin, where the behavior of the child can make use of the behavior of the parent." + [(mixed parent child)]) - ($.definition /.before - "Executes an action before doing the main work." - [(before monad action)]) + ($.definition /.advice + "Only apply then mixin when the input meets some criterion." + [(advice when then)]) - ($.definition /.after - "Executes an action after doing the main work." - [(after monad action)]) + ($.definition /.before + "Executes an action before doing the main work." + [(before monad action)]) - ($.definition (/.Recursive input output) - "An indirectly recursive function.") + ($.definition /.after + "Executes an action after doing the main work." + [(after monad action)]) - ($.definition /.of_recursive - "Transform an indirectly recursive function into a mixin." - [(of_recursive recursive)])] - [])) + ($.definition (/.Recursive input output) + "An indirectly recursive function.") + + ($.definition /.of_recursive + "Transform an indirectly recursive function into a mixin." + [(of_recursive recursive)]) + )) diff --git a/stdlib/source/documentation/lux/control/function/mutual.lux b/stdlib/source/documentation/lux/control/function/mutual.lux index 05c89af6c..9a6930379 100644 --- a/stdlib/source/documentation/lux/control/function/mutual.lux +++ b/stdlib/source/documentation/lux/control/function/mutual.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except let def) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,38 +8,39 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.let - "Locally-defined mutually-recursive functions." - [(let [(even? number) - (-> Nat Bit) - (case number - 0 true - _ (odd? (-- number))) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") - (odd? number) - (-> Nat Bit) - (case number - 0 false - _ (even? (-- number)))] - (and (even? 4) - (odd? 5)))]) + ($.definition /.let + "Locally-defined mutually-recursive functions." + [(let [(even? number) + (-> Nat Bit) + (case number + 0 true + _ (odd? (-- number))) - ($.definition /.def - "Globally-defined mutually-recursive functions." - [(def - [.public (even? number) - (-> Nat Bit) - (case number - 0 true - _ (odd? (-- number)))] + (odd? number) + (-> Nat Bit) + (case number + 0 false + _ (even? (-- number)))] + (and (even? 4) + (odd? 5)))]) - [.public (odd? number) - (-> Nat Bit) - (case number - 0 false - _ (even? (-- number)))])])] - [])) + ($.definition /.def + "Globally-defined mutually-recursive functions." + [(def + [.public (even? number) + (-> Nat Bit) + (case number + 0 true + _ (odd? (-- number)))] + + [.public (odd? number) + (-> Nat Bit) + (case number + 0 false + _ (even? (-- number)))])]) + )) diff --git a/stdlib/source/documentation/lux/control/function/predicate.lux b/stdlib/source/documentation/lux/control/function/predicate.lux index a8a4fffe7..53ab7de88 100644 --- a/stdlib/source/documentation/lux/control/function/predicate.lux +++ b/stdlib/source/documentation/lux/control/function/predicate.lux @@ -1,6 +1,6 @@ (.require [library - [lux + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,35 +8,36 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.union) - ($.definition /.intersection) - ($.definition /.functor) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Predicate it) - "A question that can be asked of a value, yield either false (#0) or true (#1).") + ($.definition /.union) + ($.definition /.intersection) + ($.definition /.functor) - ($.definition /.none - "A predicate that always fails.") + ($.definition (/.Predicate it) + "A question that can be asked of a value, yield either false (#0) or true (#1).") - ($.definition /.or - "A predicate that meets either predecessor.") + ($.definition /.none + "A predicate that always fails.") - ($.definition /.all - "A predicate that always succeeds.") + ($.definition /.or + "A predicate that meets either predecessor.") - ($.definition /.and - "A predicate that meets both predecessors.") + ($.definition /.all + "A predicate that always succeeds.") - ($.definition /.complement - "The opposite of a predicate.") + ($.definition /.and + "A predicate that meets both predecessors.") - ($.definition /.difference - "A predicate that meeds 'base', but not 'sub'.") + ($.definition /.complement + "The opposite of a predicate.") - ($.definition /.rec - "Ties the knot for a recursive predicate.")] - [])) + ($.definition /.difference + "A predicate that meeds 'base', but not 'sub'.") + + ($.definition /.rec + "Ties the knot for a recursive predicate.") + )) diff --git a/stdlib/source/documentation/lux/control/io.lux b/stdlib/source/documentation/lux/control/io.lux index 233b3da45..2e650626b 100644 --- a/stdlib/source/documentation/lux/control/io.lux +++ b/stdlib/source/documentation/lux/control/io.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,23 +9,24 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "A method for abstracting I/O and effectful computations to make it safe while writing pure functional code." - [($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) + (.List $.Documentation) + (list ($.module /._ + "A method for abstracting I/O and effectful computations to make it safe while writing pure functional code.") - ($.definition (/.IO it) - "A type that represents synchronous, effectful computations that may interact with the outside world.") + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) - ($.definition /.io - (format "Delays the evaluation of an expression, by wrapping it in an IO 'thunk'." - \n "Great for wrapping effectful computations (which will not be performed until the IO is 'run!').") - [(io (exec - (log! msg) - "Some value..."))]) + ($.definition (/.IO it) + "A type that represents synchronous, effectful computations that may interact with the outside world.") - ($.definition /.run! - "A way to execute IO computations and perform their side-effects.")] - [])) + ($.definition /.io + (format "Delays the evaluation of an expression, by wrapping it in an IO 'thunk'." + \n "Great for wrapping effectful computations (which will not be performed until the IO is 'run!').") + [(io (exec + (log! msg) + "Some value..."))]) + + ($.definition /.run! + "A way to execute IO computations and perform their side-effects.") + )) diff --git a/stdlib/source/documentation/lux/control/lazy.lux b/stdlib/source/documentation/lux/control/lazy.lux index 75ab40ce1..5e8d22e27 100644 --- a/stdlib/source/documentation/lux/control/lazy.lux +++ b/stdlib/source/documentation/lux/control/lazy.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,20 +9,21 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.value) - ($.definition /.equivalence) - ($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Lazy it) - (format "A value specified by an expression that is calculated only at the last moment possible." - \n "Afterwards, the value is cached for future reference.")) + ($.definition /.value) + ($.definition /.equivalence) + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) - ($.definition /.lazy - "Specifies a lazy value by providing the expression that computes it." - [(lazy eager_computation)])] - [])) + ($.definition (/.Lazy it) + (format "A value specified by an expression that is calculated only at the last moment possible." + \n "Afterwards, the value is cached for future reference.")) + + ($.definition /.lazy + "Specifies a lazy value by providing the expression that computes it." + [(lazy eager_computation)]) + )) diff --git a/stdlib/source/documentation/lux/control/maybe.lux b/stdlib/source/documentation/lux/control/maybe.lux index b237e8ec8..0f22bcba5 100644 --- a/stdlib/source/documentation/lux/control/maybe.lux +++ b/stdlib/source/documentation/lux/control/maybe.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,43 +9,44 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.monoid) - ($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - ($.definition /.equivalence) - ($.definition /.hash) - ($.definition /.with) - ($.definition /.list) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition /.lifted - "Wraps a monadic value with Maybe machinery." - [(lifted monad)]) + ($.definition /.monoid) + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + ($.definition /.equivalence) + ($.definition /.hash) + ($.definition /.with) + ($.definition /.list) - ($.definition /.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 "Note: the expression for the default value will not be computed if the base computation succeeds.") - [(else +20 {.#Some +10}) - "=>" - +10] - [(else +20 {.#None}) - "=>" - +20]) + ($.definition /.lifted + "Wraps a monadic value with Maybe machinery." + [(lifted monad)]) - ($.definition /.trusted - (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)]) + ($.definition /.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 "Note: the expression for the default value will not be computed if the base computation succeeds.") + [(else +20 {.#Some +10}) + "=>" + +10] + [(else +20 {.#None}) + "=>" + +20]) - ($.definition /.when - "Can be used as a guard in (co)monadic be/do expressions." - [(do monad - [value (do_something 1 2 3) - .when (passes_test? value)] - (do_something_else 4 5 6))])] - [])) + ($.definition /.trusted + (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)]) + + ($.definition /.when + "Can be used as a guard in (co)monadic be/do expressions." + [(do monad + [value (do_something 1 2 3) + .when (passes_test? value)] + (do_something_else 4 5 6))]) + )) diff --git a/stdlib/source/documentation/lux/control/parser.lux b/stdlib/source/documentation/lux/control/parser.lux index 4435c348e..1ece53c07 100644 --- a/stdlib/source/documentation/lux/control/parser.lux +++ b/stdlib/source/documentation/lux/control/parser.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except or and not) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,119 +9,120 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Parser state it) - "A generic parser.") - - ($.definition /.assertion - "Fails with the given message if the test is #0." - [(assertion message test)]) - - ($.definition /.maybe - "Optionality combinator." - [(maybe parser)]) - - ($.definition /.result - (format "Executes the parser on the input." - \n "Does not verify that all of the input has been consumed by the parser." - \n "Returns both the parser's output, and a value that represents the remaining input.") - [(result parser input)]) - - ($.definition /.and - "Sequencing combinator." - [(and first second)]) - - ($.definition /.or - "Heterogeneous alternative combinator." - [(or left right)]) - - ($.definition /.either - "Homogeneous alternative combinator." - [(either this that)]) - - ($.definition /.some - "0-or-more combinator." - [(some parser)]) - - ($.definition /.many - "1-or-more combinator." - [(many parser)]) - - ($.definition /.exactly - "Parse exactly N times." - [(exactly amount parser)]) - - ($.definition /.at_least - "Parse at least N times." - [(at_least amount parser)]) - - ($.definition /.at_most - "Parse at most N times." - [(at_most amount parser)]) - - ($.definition /.between - "" - [(between minimum additional parser)]) - - ($.definition /.separated_by - "Parses instances of 'parser' that are separated by instances of 'separator'." - [(separated_by separator parser)]) - - ($.definition /.not - "Only succeeds when the underlying parser fails." - [(not parser)]) - - ($.definition /.failure - "Always fail with this 'message'." - [(failure message)]) - - ($.definition /.lifted - "Lift a potentially failed computation into a parser." - [(lifted operation)]) - - ($.definition /.else - "If the given parser fails, returns the default value." - [(else value parser)]) - - ($.definition /.remaining - "Yield the remaining input (without consuming it).") - - ($.definition /.rec - "Combinator for recursive parsers." - [(rec parser)]) - - ($.definition /.after - "Run the parser after another one (whose output is ignored)." - [(after param subject)]) - - ($.definition /.before - "Run the parser before another one (whose output is ignored)." - [(before param subject)]) - - ($.definition /.only - "Only succeed when the parser's output passes a test." - [(only test parser)]) - - ($.definition /.parses? - "Ignore a parser's output and just verify that it succeeds." - [(parses? parser)]) - - ($.definition /.parses - "Ignore a parser's output and just execute it." - [(parses parser)]) + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) - ($.definition /.speculative - (format "Executes a parser, without actually consuming the input." - \n "That way, the same input can be consumed again by another parser.") - [(speculative parser)]) - - ($.definition /.codec - "Decode the output of a parser using a codec." - [(codec codec parser)])] - [])) + ($.definition (/.Parser state it) + "A generic parser.") + + ($.definition /.assertion + "Fails with the given message if the test is #0." + [(assertion message test)]) + + ($.definition /.maybe + "Optionality combinator." + [(maybe parser)]) + + ($.definition /.result + (format "Executes the parser on the input." + \n "Does not verify that all of the input has been consumed by the parser." + \n "Returns both the parser's output, and a value that represents the remaining input.") + [(result parser input)]) + + ($.definition /.and + "Sequencing combinator." + [(and first second)]) + + ($.definition /.or + "Heterogeneous alternative combinator." + [(or left right)]) + + ($.definition /.either + "Homogeneous alternative combinator." + [(either this that)]) + + ($.definition /.some + "0-or-more combinator." + [(some parser)]) + + ($.definition /.many + "1-or-more combinator." + [(many parser)]) + + ($.definition /.exactly + "Parse exactly N times." + [(exactly amount parser)]) + + ($.definition /.at_least + "Parse at least N times." + [(at_least amount parser)]) + + ($.definition /.at_most + "Parse at most N times." + [(at_most amount parser)]) + + ($.definition /.between + "" + [(between minimum additional parser)]) + + ($.definition /.separated_by + "Parses instances of 'parser' that are separated by instances of 'separator'." + [(separated_by separator parser)]) + + ($.definition /.not + "Only succeeds when the underlying parser fails." + [(not parser)]) + + ($.definition /.failure + "Always fail with this 'message'." + [(failure message)]) + + ($.definition /.lifted + "Lift a potentially failed computation into a parser." + [(lifted operation)]) + + ($.definition /.else + "If the given parser fails, returns the default value." + [(else value parser)]) + + ($.definition /.remaining + "Yield the remaining input (without consuming it).") + + ($.definition /.rec + "Combinator for recursive parsers." + [(rec parser)]) + + ($.definition /.after + "Run the parser after another one (whose output is ignored)." + [(after param subject)]) + + ($.definition /.before + "Run the parser before another one (whose output is ignored)." + [(before param subject)]) + + ($.definition /.only + "Only succeed when the parser's output passes a test." + [(only test parser)]) + + ($.definition /.parses? + "Ignore a parser's output and just verify that it succeeds." + [(parses? parser)]) + + ($.definition /.parses + "Ignore a parser's output and just execute it." + [(parses parser)]) + + ($.definition /.speculative + (format "Executes a parser, without actually consuming the input." + \n "That way, the same input can be consumed again by another parser.") + [(speculative parser)]) + + ($.definition /.codec + "Decode the output of a parser using a codec." + [(codec codec parser)]) + )) diff --git a/stdlib/source/documentation/lux/control/pipe.lux b/stdlib/source/documentation/lux/control/pipe.lux index 71d9faea5..50d232154 100644 --- a/stdlib/source/documentation/lux/control/pipe.lux +++ b/stdlib/source/documentation/lux/control/pipe.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except let cond if exec case) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,97 +9,98 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "Composable extensions to the piping macros (|> and <|) that enhance them with various abilities." - [($.definition /.new - "Ignores the piped argument, and begins a new pipe." - [(n.= 1 - (|> 20 - (n.* 3) - (n.+ 4) - (new 0 [++])))]) + (.List $.Documentation) + (list ($.module /._ + "Composable extensions to the piping macros (|> and <|) that enhance them with various abilities.") - ($.definition /.let - "Gives a name to the piped-argument, within the given expression." - [(n.= 10 - (|> 5 - (let x (n.+ x x))))]) + ($.definition /.new + "Ignores the piped argument, and begins a new pipe." + [(n.= 1 + (|> 20 + (n.* 3) + (n.+ 4) + (new 0 [++])))]) - ($.definition /.cond - (format "Branching for pipes." - \n "Both the tests and the bodies are piped-code, and must be given inside a tuple.") - [(|> +5 - (cond [i.even?] [(i.* +2)] - [i.odd?] [(i.* +3)] - [(new -1 [])]))]) + ($.definition /.let + "Gives a name to the piped-argument, within the given expression." + [(n.= 10 + (|> 5 + (let x (n.+ x x))))]) - ($.definition /.if - "If-branching." - [(same? (if (n.even? sample) - "even" - "odd") - (|> sample - (if [n.even?] - [(new "even" [])] - [(new "odd" [])])))]) + ($.definition /.cond + (format "Branching for pipes." + \n "Both the tests and the bodies are piped-code, and must be given inside a tuple.") + [(|> +5 + (cond [i.even?] [(i.* +2)] + [i.odd?] [(i.* +3)] + [(new -1 [])]))]) - ($.definition /.when - "Only execute the body when the test passes." - [(same? (if (n.even? sample) - (n.* 2 sample) - sample) - (|> sample - (when [n.even?] - [(n.* 2)])))]) + ($.definition /.if + "If-branching." + [(same? (if (n.even? sample) + "even" + "odd") + (|> sample + (if [n.even?] + [(new "even" [])] + [(new "odd" [])])))]) - ($.definition /.while - (format "While loops for pipes." - \n "Both the testing and calculating steps are pipes and must be given inside tuples.") - [(|> +1 - (while [(i.< +10)] - [++]))]) + ($.definition /.when + "Only execute the body when the test passes." + [(same? (if (n.even? sample) + (n.* 2 sample) + sample) + (|> sample + (when [n.even?] + [(n.* 2)])))]) - ($.definition /.do - (format "Monadic pipes." - \n "Each steps in the monadic computation is a pipe and must be given inside a tuple.") - [(|> +5 - (do identity.monad - [(i.* +3)] - [(i.+ +4)] + ($.definition /.while + (format "While loops for pipes." + \n "Both the testing and calculating steps are pipes and must be given inside tuples.") + [(|> +1 + (while [(i.< +10)] [++]))]) - ($.definition /.exec - (format "Non-updating pipes." - \n "Will generate piped computations, but their results will not be used in the larger scope.") - [(|> +5 - (exec [.nat %n log!]) - (i.* +10))]) + ($.definition /.do + (format "Monadic pipes." + \n "Each steps in the monadic computation is a pipe and must be given inside a tuple.") + [(|> +5 + (do identity.monad + [(i.* +3)] + [(i.+ +4)] + [++]))]) - ($.definition /.tuple - (format "Parallel branching for pipes." - \n "Allows to run multiple pipelines for a value and gives you a tuple of the outputs.") - [(|> +5 - (tuple [(i.* +10)] - [-- (i./ +2)] - [i#encoded])) - "=>" - [+50 +2 "+5"]]) + ($.definition /.exec + (format "Non-updating pipes." + \n "Will generate piped computations, but their results will not be used in the larger scope.") + [(|> +5 + (exec [.nat %n log!]) + (i.* +10))]) - ($.definition /.case - (format "Pattern-matching for pipes." - \n "The bodies of each branch are NOT pipes; just regular values.") - [(|> +5 - (case - +0 "zero" - +1 "one" - +2 "two" - +3 "three" - +4 "four" - +5 "five" - +6 "six" - +7 "seven" - +8 "eight" - +9 "nine" - _ "???"))])] - [])) + ($.definition /.tuple + (format "Parallel branching for pipes." + \n "Allows to run multiple pipelines for a value and gives you a tuple of the outputs.") + [(|> +5 + (tuple [(i.* +10)] + [-- (i./ +2)] + [i#encoded])) + "=>" + [+50 +2 "+5"]]) + + ($.definition /.case + (format "Pattern-matching for pipes." + \n "The bodies of each branch are NOT pipes; just regular values.") + [(|> +5 + (case + +0 "zero" + +1 "one" + +2 "two" + +3 "three" + +4 "four" + +5 "five" + +6 "six" + +7 "seven" + +8 "eight" + +9 "nine" + _ "???"))]) + )) diff --git a/stdlib/source/documentation/lux/control/reader.lux b/stdlib/source/documentation/lux/control/reader.lux index 624627756..33f324843 100644 --- a/stdlib/source/documentation/lux/control/reader.lux +++ b/stdlib/source/documentation/lux/control/reader.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except local) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,31 +9,32 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - - ($.definition (/.Reader environment it) - "Computations that have access to some environmental value.") - - ($.definition /.read - "Get the environment.") - - ($.definition /.local - "Run computation with a locally-modified environment." - [(local change proc)]) - - ($.definition /.result - "Executes the reader against the given environment." - [(result env proc)]) - - ($.definition /.with - "Monad transformer for Reader." - [(with monad)]) - - ($.definition /.lifted - "Lift monadic values to the Reader wrapper.")] - [])) + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + + ($.definition (/.Reader environment it) + "Computations that have access to some environmental value.") + + ($.definition /.read + "Get the environment.") + + ($.definition /.local + "Run computation with a locally-modified environment." + [(local change proc)]) + + ($.definition /.result + "Executes the reader against the given environment." + [(result env proc)]) + + ($.definition /.with + "Monad transformer for Reader." + [(with monad)]) + + ($.definition /.lifted + "Lift monadic values to the Reader wrapper.") + )) diff --git a/stdlib/source/documentation/lux/control/region.lux b/stdlib/source/documentation/lux/control/region.lux index b90efa389..bd80295d6 100644 --- a/stdlib/source/documentation/lux/control/region.lux +++ b/stdlib/source/documentation/lux/control/region.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,35 +9,36 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.clean_up_error) - ($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - - ($.definition (/.Region r ! it) - (format "A region where resources may be be claimed and where a side-effecting computation may be performed." - \n "Every resource is paired with a function that knows how to clean/reclaim it, to make sure there are no leaks.")) - - ($.definition /.run! - "Executes a region-based computation, with a side-effect determined by the monad." - [(run! monad computation)]) - - ($.definition /.acquire! - "Acquire a resource while pairing it a function that knows how to reclaim it." - [(acquire! monad cleaner value)]) - - ($.definition /.failure - "Immediately fail with this 'message'." - [(failure monad error)]) - - ($.definition /.except - "Fail by throwing/raising an exception." - [(except monad exception message)]) - - ($.definition /.lifted - "Lift an effectful computation into a region-based computation." - [(lifted monad operation)])] - [])) + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.clean_up_error) + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + + ($.definition (/.Region r ! it) + (format "A region where resources may be be claimed and where a side-effecting computation may be performed." + \n "Every resource is paired with a function that knows how to clean/reclaim it, to make sure there are no leaks.")) + + ($.definition /.run! + "Executes a region-based computation, with a side-effect determined by the monad." + [(run! monad computation)]) + + ($.definition /.acquire! + "Acquire a resource while pairing it a function that knows how to reclaim it." + [(acquire! monad cleaner value)]) + + ($.definition /.failure + "Immediately fail with this 'message'." + [(failure monad error)]) + + ($.definition /.except + "Fail by throwing/raising an exception." + [(except monad exception message)]) + + ($.definition /.lifted + "Lift an effectful computation into a region-based computation." + [(lifted monad operation)]) + )) diff --git a/stdlib/source/documentation/lux/control/remember.lux b/stdlib/source/documentation/lux/control/remember.lux index ffe3b0330..f25d2e038 100644 --- a/stdlib/source/documentation/lux/control/remember.lux +++ b/stdlib/source/documentation/lux/control/remember.lux @@ -9,35 +9,36 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.must_remember) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition /.remember - (format "A message with an expiration date." - \n "Can have an optional piece of code to focus on.") - [(remember "2022-04-01" - "Do this, that and the other.")] - [(remember "2022-04-01" - "Improve the performace." - (some (complicated (computation 123))))]) + ($.definition /.must_remember) - ($.definition /.to_do - (format "A TODO message with an expiration date." - \n "Can have an optional piece of code to focus on.") - [(to_do "2022-04-01" - "Do this, that and the other.")] - [(to_do "2022-04-01" - "Improve the performace." - (some (complicated (computation 123))))]) + ($.definition /.remember + (format "A message with an expiration date." + \n "Can have an optional piece of code to focus on.") + [(remember "2022-04-01" + "Do this, that and the other.")] + [(remember "2022-04-01" + "Improve the performace." + (some (complicated (computation 123))))]) - ($.definition /.fix_me - (format "A FIXME message with an expiration date." - \n "Can have an optional piece of code to focus on.") - [(fix_me "2022-04-01" - "Do this, that and the other.")] - [(fix_me "2022-04-01" - "Improve the performace." - (some (complicated (computation 123))))])] - [])) + ($.definition /.to_do + (format "A TODO message with an expiration date." + \n "Can have an optional piece of code to focus on.") + [(to_do "2022-04-01" + "Do this, that and the other.")] + [(to_do "2022-04-01" + "Improve the performace." + (some (complicated (computation 123))))]) + + ($.definition /.fix_me + (format "A FIXME message with an expiration date." + \n "Can have an optional piece of code to focus on.") + [(fix_me "2022-04-01" + "Do this, that and the other.")] + [(fix_me "2022-04-01" + "Improve the performace." + (some (complicated (computation 123))))]) + )) diff --git a/stdlib/source/documentation/lux/control/security.lux b/stdlib/source/documentation/lux/control/security.lux index 2c18b0150..4a39f5fd2 100644 --- a/stdlib/source/documentation/lux/control/security.lux +++ b/stdlib/source/documentation/lux/control/security.lux @@ -12,7 +12,7 @@ ["[1][0]" policy]]) (.def .public documentation - (.List $.Module) + (.List $.Documentation) (list.together (list /policy.documentation /capability.documentation))) diff --git a/stdlib/source/documentation/lux/control/security/capability.lux b/stdlib/source/documentation/lux/control/security/capability.lux index d328cabd3..cbd415861 100644 --- a/stdlib/source/documentation/lux/control/security/capability.lux +++ b/stdlib/source/documentation/lux/control/security/capability.lux @@ -8,30 +8,31 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition (/.Capability brand input output) - (format "Represents the capability to perform an operation." - \n "This operation is assumed to have security implications.")) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition /.use - "Applies a capability against its required input." - [(use capability input)]) + ($.definition (/.Capability brand input output) + (format "Represents the capability to perform an operation." + \n "This operation is assumed to have security implications.")) - ($.definition /.capability - "Defines a capability as a unique type, and a constructor for instances." - [(capability (Can_Duplicate a) - (can_duplicate a [a a])) - - (let [capability (can_duplicate - (function (_ value) - [value value])) - [left right] (..use capability 123)] - (same? left right))]) + ($.definition /.use + "Applies a capability against its required input." + [(use capability input)]) - ($.definition /.async - "Converts a synchronous I/O-based capability into an asynchronous capability." - [(async capability)])] - [])) + ($.definition /.capability + "Defines a capability as a unique type, and a constructor for instances." + [(capability (Can_Duplicate a) + (can_duplicate a [a a])) + + (let [capability (can_duplicate + (function (_ value) + [value value])) + [left right] (..use capability 123)] + (same? left right))]) + + ($.definition /.async + "Converts a synchronous I/O-based capability into an asynchronous capability." + [(async capability)]) + )) diff --git a/stdlib/source/documentation/lux/control/security/policy.lux b/stdlib/source/documentation/lux/control/security/policy.lux index 8666e7e6a..a05987aee 100644 --- a/stdlib/source/documentation/lux/control/security/policy.lux +++ b/stdlib/source/documentation/lux/control/security/policy.lux @@ -9,70 +9,71 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - ($.definition /.Private) - ($.definition /.Can_Conceal) - ($.definition /.Can_Reveal) - ($.definition /.Safe) - ($.definition /.Can_Trust) - ($.definition /.Can_Distrust) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Policy brand value %) - "A security policy encoded as the means to 'upgrade' or 'downgrade' in a secure context.") + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + ($.definition /.Private) + ($.definition /.Can_Conceal) + ($.definition /.Can_Reveal) + ($.definition /.Safe) + ($.definition /.Can_Trust) + ($.definition /.Can_Distrust) - ($.definition (/.Can_Upgrade brand % value) - "Represents the capacity to 'upgrade' a value.") + ($.definition (/.Policy brand value %) + "A security policy encoded as the means to 'upgrade' or 'downgrade' in a secure context.") - ($.definition (/.Can_Downgrade brand % value) - "Represents the capacity to 'downgrade' a value.") + ($.definition (/.Can_Upgrade brand % value) + "Represents the capacity to 'upgrade' a value.") - ($.definition (/.Privilege brand %) - "Represents the privilege to both 'upgrade' and 'downgrade' a value.") + ($.definition (/.Can_Downgrade brand % value) + "Represents the capacity to 'downgrade' a value.") - ($.definition (/.Delegation brand %from %to) - "Represents the act of delegating policy capacities.") + ($.definition (/.Privilege brand %) + "Represents the privilege to both 'upgrade' and 'downgrade' a value.") - ($.definition /.delegation - "Delegating policy capacities." - [(delegation downgrade upgrade)]) + ($.definition (/.Delegation brand %from %to) + "Represents the act of delegating policy capacities.") - ($.definition (/.Context brand scope %) - "A computational context with an associated policy privilege.") + ($.definition /.delegation + "Delegating policy capacities." + [(delegation downgrade upgrade)]) - ($.definition /.with_policy - "Activates a security context with the priviledge to enforce it's policy." - [(type Password - (Private Text)) + ($.definition (/.Context brand scope %) + "A computational context with an associated policy privilege.") - (type (Policy %) - (Interface - (is (-> Text (Password %)) - password) - (is (-> (Password %) Text) - unsafe))) + ($.definition /.with_policy + "Activates a security context with the priviledge to enforce it's policy." + [(type Password + (Private Text)) - (def (policy _) - (Ex (_ %) (-> Any (Policy %))) - (with_policy - (is (Context Privacy Policy) - (function (_ (open "%::.")) - (implementation - (def (password value) - (%::can_upgrade value)) - (def (unsafe password) - (%::can_downgrade password)))))))] - [(with_policy context)]) + (type (Policy %) + (Interface + (is (-> Text (Password %)) + password) + (is (-> (Password %) Text) + unsafe))) - ($.definition /.Privacy - (format "A security context for privacy." - \n "Private data is data which cannot be allowed to leak outside of the programmed.")) + (def (policy _) + (Ex (_ %) (-> Any (Policy %))) + (with_policy + (is (Context Privacy Policy) + (function (_ (open "%::.")) + (implementation + (def (password value) + (%::can_upgrade value)) + (def (unsafe password) + (%::can_downgrade password)))))))] + [(with_policy context)]) - ($.definition /.Safety - (format "A security context for safety." - \n "Safe data is data coming from outside the program which can be trusted to be properly formatted and lacking injections."))] - [])) + ($.definition /.Privacy + (format "A security context for privacy." + \n "Private data is data which cannot be allowed to leak outside of the programmed.")) + + ($.definition /.Safety + (format "A security context for safety." + \n "Safe data is data coming from outside the program which can be trusted to be properly formatted and lacking injections.")) + )) diff --git a/stdlib/source/documentation/lux/control/state.lux b/stdlib/source/documentation/lux/control/state.lux index ae14eafb1..5784561df 100644 --- a/stdlib/source/documentation/lux/control/state.lux +++ b/stdlib/source/documentation/lux/control/state.lux @@ -9,59 +9,60 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.State state it) - "Stateful computations.") + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) - ($.definition /.get - "Read the current state.") + ($.definition (/.State state it) + "Stateful computations.") - ($.definition /.put - "Set the new state." - [(put new_state)]) + ($.definition /.get + "Read the current state.") - ($.definition /.update - "Compute the new state." - [(update change)]) + ($.definition /.put + "Set the new state." + [(put new_state)]) - ($.definition /.use - "Run a function on the current state." - [(use user)]) + ($.definition /.update + "Compute the new state." + [(update change)]) - ($.definition /.local - "Run the computation with a locally-modified state." - [(local change action)]) + ($.definition /.use + "Run a function on the current state." + [(use user)]) - ($.definition /.result - "Run a stateful computation." - [(result state action)]) + ($.definition /.local + "Run the computation with a locally-modified state." + [(local change action)]) - ($.definition /.while - "A stateful while loop." - [(while condition body)]) + ($.definition /.result + "Run a stateful computation." + [(result state action)]) - ($.definition /.do_while - "A stateful do-while loop." - [(do_while condition body)]) + ($.definition /.while + "A stateful while loop." + [(while condition body)]) - ($.definition /.+State - "Stateful computations decorated by a monad.") + ($.definition /.do_while + "A stateful do-while loop." + [(do_while condition body)]) - ($.definition /.result' - "Execute a stateful computation decorated by a monad." - [(result' state action)]) + ($.definition /.+State + "Stateful computations decorated by a monad.") - ($.definition /.with - "A monad transformer to create composite stateful computations." - [(with monad)]) + ($.definition /.result' + "Execute a stateful computation decorated by a monad." + [(result' state action)]) - ($.definition /.lifted - "Lift monadic values to the +State wrapper." - [(lifted monad ma)])] - [])) + ($.definition /.with + "A monad transformer to create composite stateful computations." + [(with monad)]) + + ($.definition /.lifted + "Lift monadic values to the +State wrapper." + [(lifted monad ma)]) + )) diff --git a/stdlib/source/documentation/lux/control/thread.lux b/stdlib/source/documentation/lux/control/thread.lux index f567f5267..46f716a46 100644 --- a/stdlib/source/documentation/lux/control/thread.lux +++ b/stdlib/source/documentation/lux/control/thread.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except local) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,39 +9,40 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - - ($.definition (/.Thread ! it) - "An imperative process with access to mutable values.") - - ($.definition (/.Box ! it) - "A mutable box holding a value.") - - ($.definition /.box - "A brand-new box initialized to the given value." - [(box init)]) - - ($.definition /.read! - "Reads the current value in the box." - [(read! box)]) - - ($.definition /.write! - "Mutates the value in the box." - [(write! value box)]) - - ($.definition /.result - "Executes the imperative thread in a self-contained way." - [(result thread)]) - - ($.definition /.io - "Transforms the imperative thread into an I/O computation.") - - ($.definition /.update! - "Update a box's value by applying a function to it." - [(update! f box)])] - [])) + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + + ($.definition (/.Thread ! it) + "An imperative process with access to mutable values.") + + ($.definition (/.Box ! it) + "A mutable box holding a value.") + + ($.definition /.box + "A brand-new box initialized to the given value." + [(box init)]) + + ($.definition /.read! + "Reads the current value in the box." + [(read! box)]) + + ($.definition /.write! + "Mutates the value in the box." + [(write! value box)]) + + ($.definition /.result + "Executes the imperative thread in a self-contained way." + [(result thread)]) + + ($.definition /.io + "Transforms the imperative thread into an I/O computation.") + + ($.definition /.update! + "Update a box's value by applying a function to it." + [(update! f box)]) + )) diff --git a/stdlib/source/documentation/lux/control/try.lux b/stdlib/source/documentation/lux/control/try.lux index 09025de4f..0019ec86c 100644 --- a/stdlib/source/documentation/lux/control/try.lux +++ b/stdlib/source/documentation/lux/control/try.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except local) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,45 +9,46 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - ($.definition /.equivalence) - - ($.definition (/.Try it) - "A computation that can fail with an error message.") - - ($.definition /.with - "Enhances a monad with error-handling functionality." - [(with monad)]) - - ($.definition /.lifted - "Wraps a monadic value with error-handling machinery." - [(lifted monad)]) - - ($.definition /.trusted - (format "Assumes a Try value succeeded, and yields its value." - \n "If it didn't, raises the error as a runtime error." - \n "WARNING: Use with caution.") - [(trusted try)]) - - ($.definition /.maybe - "" - [(maybe try)]) - - ($.definition /.of_maybe - "" - [(of_maybe maybe)]) - - ($.definition /.else - (format "Allows you to provide a default value that will be used" - \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"}))] - [(= "foo" - (else "foo" {/.#Failure "KABOOM!"}))])] - [])) + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + ($.definition /.equivalence) + + ($.definition (/.Try it) + "A computation that can fail with an error message.") + + ($.definition /.with + "Enhances a monad with error-handling functionality." + [(with monad)]) + + ($.definition /.lifted + "Wraps a monadic value with error-handling machinery." + [(lifted monad)]) + + ($.definition /.trusted + (format "Assumes a Try value succeeded, and yields its value." + \n "If it didn't, raises the error as a runtime error." + \n "WARNING: Use with caution.") + [(trusted try)]) + + ($.definition /.maybe + "" + [(maybe try)]) + + ($.definition /.of_maybe + "" + [(of_maybe maybe)]) + + ($.definition /.else + (format "Allows you to provide a default value that will be used" + \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"}))] + [(= "foo" + (else "foo" {/.#Failure "KABOOM!"}))]) + )) diff --git a/stdlib/source/documentation/lux/control/writer.lux b/stdlib/source/documentation/lux/control/writer.lux index 50129e1fb..36417304f 100644 --- a/stdlib/source/documentation/lux/control/writer.lux +++ b/stdlib/source/documentation/lux/control/writer.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except local) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,25 +9,26 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Writer log value) - "Represents a value with an associated 'log' to record arbitrary information.") + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) - ($.definition /.write - "Write a value to the log." - [(write message)]) + ($.definition (/.Writer log value) + "Represents a value with an associated 'log' to record arbitrary information.") - ($.definition /.with - "Enhances a monad with Writer functionality." - [(with monoid monad)]) + ($.definition /.write + "Write a value to the log." + [(write message)]) - ($.definition /.lifted - "Wraps a monadic value with Writer machinery." - [(lifted monoid monad)])] - [])) + ($.definition /.with + "Enhances a monad with Writer functionality." + [(with monoid monad)]) + + ($.definition /.lifted + "Wraps a monadic value with Writer machinery." + [(lifted monoid monad)]) + )) diff --git a/stdlib/source/documentation/lux/ffi.js.lux b/stdlib/source/documentation/lux/ffi.js.lux index a0e8edaef..3048cea36 100644 --- a/stdlib/source/documentation/lux/ffi.js.lux +++ b/stdlib/source/documentation/lux/ffi.js.lux @@ -46,7 +46,7 @@ ($.definition /.type_of "The type of an object, as text." [(= "boolean" - (type_of #1))] + (type_of true))] [(= "number" (type_of +123.456))] [(= "string" diff --git a/stdlib/source/documentation/lux/ffi.jvm.lux b/stdlib/source/documentation/lux/ffi.jvm.lux index 404fa4b63..376d9958d 100644 --- a/stdlib/source/documentation/lux/ffi.jvm.lux +++ b/stdlib/source/documentation/lux/ffi.jvm.lux @@ -102,7 +102,7 @@ ... Methods ("public" [] (new [value A]) [] (exec - (:= ::foo #1) + (:= ::foo true) (:= ::bar value) (:= ::baz "") [])) @@ -119,7 +119,7 @@ "Fields and methods defined in the class can be used with special syntax." "For example:" "::resolved, for accessing the 'resolved' field." - "(:= ::resolved #1) for modifying it." + "(:= ::resolved true) for modifying it." "(::new! []) for calling the class's constructor." "(::resolve! container [value]) for calling the 'resolve' method."]) diff --git a/stdlib/source/documentation/lux/ffi.old.lux b/stdlib/source/documentation/lux/ffi.old.lux index 490e8416f..a862963d8 100644 --- a/stdlib/source/documentation/lux/ffi.old.lux +++ b/stdlib/source/documentation/lux/ffi.old.lux @@ -61,7 +61,7 @@ ... Methods ("public" [] (new [value A]) [] (exec - (:= ::foo #1) + (:= ::foo true) (:= ::bar value) (:= ::baz "") [])) @@ -76,7 +76,7 @@ "Fields and methods defined in the class can be used with special syntax." "For example:" "::resolved, for accessing the 'resolved' field." - "(:= ::resolved #1) for modifying it." + "(:= ::resolved true) for modifying it." "(::new! []) for calling the class's constructor." "(::resolve! container [value]) for calling the 'resolve' method."]) diff --git a/stdlib/source/experiment/tool/interpreter.lux b/stdlib/source/experiment/tool/interpreter.lux index c6e9c5de3..ad8092a5b 100644 --- a/stdlib/source/experiment/tool/interpreter.lux +++ b/stdlib/source/experiment/tool/interpreter.lux @@ -204,7 +204,7 @@ (loop (again [context [#configuration configuration #state state #source ..fresh_source] - multi_line? #0]) + multi_line? false]) (do ! [_ (if multi_line? (at Console<!> write " ") @@ -217,11 +217,11 @@ {try.#Success [context' representation]} (do ! [_ (at Console<!> write representation)] - (again context' #0)) + (again context' false)) {try.#Failure error} (if (ex.match? syntax.end_of_file error) - (again context #1) + (again context true) (exec (log! (ex.error ..error error)) - (again (has #source ..fresh_source context) #0)))))) + (again (has #source ..fresh_source context) false)))))) ))) 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 [<name> <tag>] + [(def' .private (<name> type) + (type_literal (-> Type (List Type))) + ({{<tag> left right} + (list#partial left (<name> 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 [<name> <tag>] - [(def (<name> type) - (-> Type (List Type)) - (case type - {<tag> left right} - (list#partial left (<name> 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 [<name>] - [{#Named ["library/lux" <name>] _} - 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 [<name> <type> <wrapper>] - [{#Named ["library/lux" <name>] _} - (in (<wrapper> (as <type> 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 [<tag>] - [[meta {<tag> parts}] - (do meta#monad - [=parts (monad#each meta#monad literal parts)] - (in [meta {<tag> =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))) [<@> {<tag> (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<a> = 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 [<tag> <struct>] [[{<tag> x'} {<tag> 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 @@ [_ (<text>.this <token>)] (in <value>)))] - [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 [<char>] - [(static <char>) + [<char> 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 [<char> <replacement>] - [(static <char>) + [<char> (let [[previous' current' limit'] (ascii_escaped <replacement> 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 [<sigil> <un_escaped>] - [(static <sigil>) + [<sigil> (let [[previous' current' limit'] (..ascii_un_escaped <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 [_ (<text>.this "(?:") - [_ scoped] (re_alternative^ #0 re_scoped^ current_module) + [_ scoped] (re_alternative^ false re_scoped^ current_module) _ (<text>.this ")")] (in [{#Non_Capturing} scoped])) (do <>.monad @@ -401,18 +401,18 @@ [_ (<text>.this "(?<") captured_symbol symbol_part^ _ (<text>.this ">") - [num_captures pattern] (re_alternative^ #1 re_scoped^ current_module) + [num_captures pattern] (re_alternative^ true re_scoped^ current_module) _ (<text>.this ")")] (in [{#Capturing [{.#Some captured_symbol} num_captures]} pattern])) (do <>.monad [_ (<text>.this "(") - [num_captures pattern] (re_alternative^ #1 re_scoped^ current_module) + [num_captures pattern] (re_alternative^ true re_scoped^ current_module) _ (<text>.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 <code>.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]) (` (<extension> (,* (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 [<comparison> <name>] @@ -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 <codec> decoded) (at try.functor each (|>> .int))) - (static ..-sign) + ..-sign (|> repr ("lux text clip" 1 (-- input_size)) (at <codec> 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] <alternatively> ... There is nothing the addition adds to the coverage. - [#1 #1] + [.true .true] <redundancy>) ... 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 {<tag>} module)) @@ -184,8 +192,11 @@ {.#Some module} {try.#Success [state (case (the .#module_state module) - {<tag>} #1 - _ #0)]} + {<tag>} + 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 <constant>)))) attribute (attribute.constant constant)] - (field.field ..constant::modifier name #1 <type> (sequence.sequence attribute)))]) + (field.field ..constant::modifier name true <type> (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 <constant>)))) attribute (attribute.constant constant)] - (field.field ..constant::modifier name #1 <type> (sequence.sequence attribute)))]) + (field.field ..constant::modifier name true <type> (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 (<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] (<definer> archive (as Text name) (let [raw_type (type_literal <def_type>)] (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 "<init>" - #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 "<clinit>" - #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}))) <init>::method (method.method method.public "<init>" - #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 <default>)]) - ([/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 [<tag>] @@ -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 [<pattern>] [<pattern> - #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 [<tag>] [[{<tag>} {<tag>}] - #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 [<nat> <day>] + [{<day>} <nat>]) + ([0 #Sunday] + [1 #Monday] + [2 #Tuesday] + [3 #Wednesday] + [4 #Thursday] + [5 #Friday] + [6 #Saturday]))) (def .public order (Order Day) diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux index f94f56037..6300dc4fc 100644 --- a/stdlib/source/program/aedifex.lux +++ b/stdlib/source/program/aedifex.lux @@ -85,7 +85,7 @@ profile) [exit_code output] ((command console environment (file.async file.default) (shell.async shell.default) resolution) profile) _ (case exit_code - (static shell.normal) + shell.normal (in []) _ diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 190ec3802..503fd5f1c 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -104,7 +104,7 @@ {.#Some dependency} (case lux_name (^.with_template [<tag> <name>] - [(static <name>) + [<name> {try.#Success [(..remove_dependency dependency resolution) {<tag> dependency}]}]) ([#JVM ..jvm_lux_name] diff --git a/stdlib/source/program/aedifex/repository/remote.lux b/stdlib/source/program/aedifex/repository/remote.lux index b5b201093..10b7f372d 100644 --- a/stdlib/source/program/aedifex/repository/remote.lux +++ b/stdlib/source/program/aedifex/repository/remote.lux @@ -68,7 +68,7 @@ {.#None} http))] (case status - (static http/status.ok) + http/status.ok (at ! each product.right ((the @http.#body message) {.#None})) _ @@ -91,7 +91,7 @@ http)) _ ((the @http.#body message) {.#Some 0})] (case status - (static http/status.created) + http/status.created (in []) _ diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index 31b5ac78a..487f9984b 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -35,34 +35,34 @@ (text#= expected actual) _ - #0)) + false)) (def (enforced? parser input) (All (_ s) (-> (Parser s Any) s Bit)) (case (/.result parser input) {try.#Success [_ []]} - #1 + true _ - #0)) + false)) (def (found? parser input) (All (_ s) (-> (Parser s Bit) s Bit)) (case (/.result parser input) - {try.#Success [_ #1]} - #1 + {try.#Success [_ .true]} + true _ - #0)) + false)) (def (fails? input) (All (_ a) (-> (Try a) Bit)) (case input {try.#Failure _} - #1 + true _ - #0)) + false)) (def match (syntax (_ [pattern <code>.any @@ -73,7 +73,7 @@ (, then) (,' _) - #0)))))) + false)))))) (def combinators_0 Test @@ -93,7 +93,7 @@ (|> (list (code.int (.int expected0))) (/.result (/.maybe <code>.nat)) (match {.#None} - #1)))) + true)))) (_.coverage [/.some] (and (|> (list#each code.nat expected+) (/.result (/.some <code>.nat)) @@ -102,7 +102,7 @@ (|> (list#each (|>> .int code.int) expected+) (/.result (/.some <code>.nat)) (match {.#End} - #1)))) + true)))) (_.coverage [/.many] (and (|> (list#each code.nat expected+) (/.result (/.many <code>.nat)) @@ -163,7 +163,7 @@ fails?) (|> (list (code.bit not0)) (/.result (/.not <code>.nat)) - (match [] #1)))) + (match [] true)))) ))) (def combinators_1 @@ -365,10 +365,10 @@ (should_fail failure)))) (_.coverage [/.assertion] (and (|> (list (code.bit #1) (code.int +123)) - (/.result (/.assertion assertion #1)) + (/.result (/.assertion assertion true)) (match [] true)) (|> (list (code.bit #1) (code.int +123)) - (/.result (/.assertion assertion #0)) + (/.result (/.assertion assertion false)) fails?))) ..combinators_0 ..combinators_1 diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index c43caf3a4..c6514691e 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -362,7 +362,7 @@ post \\parser.end?] (in (and (not pre) post)))) - (!expect {try.#Success #1})))) + (!expect {try.#Success .true})))) (do [! random.monad] [to_read (at ! each (n.% (++ ..segment_size)) random.nat) data (at ! each (at utf8.codec encoded) (random.ascii ..segment_size))] @@ -377,7 +377,7 @@ (in (and (n.= 0 start) (n.= to_read offset) (n.= ..segment_size nothing_left))))) - (!expect {try.#Success #1})))) + (!expect {try.#Success .true})))) (do [! random.monad] [to_read (at ! each (n.% (++ ..segment_size)) random.nat) data (at ! each (at utf8.codec encoded) (random.ascii ..segment_size))] @@ -391,7 +391,7 @@ (in (and (n.= ..segment_size (n.+ to_read remaining)) (n.= 0 nothing_left))))) - (!expect {try.#Success #1})))) + (!expect {try.#Success .true})))) ..size ..binary ..utf8 @@ -589,7 +589,7 @@ (at (list.equivalence n.equivalence) = binary_vals slice_vals) _ - #0)))) + false)))) (_.coverage [/.slice_out_of_bounds] (and (throws? /.slice_out_of_bounds (/.slice size size sample)) (let [verdict (throws? /.slice_out_of_bounds (/.slice offset size sample))] diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index 24f9415b8..5cb3bc1c1 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -76,23 +76,23 @@ (_.coverage [/.min] (case [(/.min sample) (list.head sorted_values)] [{.#None} {.#None}] - #1 + true [{.#Some reference} {.#Some sample}] (n.= reference sample) _ - #0)) + false)) (_.coverage [/.max] (case [(/.max sample) (list.last sorted_values)] [{.#None} {.#None}] - #1 + true [{.#Some reference} {.#Some sample}] (n.= reference sample) _ - #0)) + false)) (_.coverage [/.entries] (list#= (/.entries sample) sorted_pairs)) diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index e057efcfe..3fffb74a1 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -89,9 +89,9 @@ (at <equivalence> = expected actual))))) (_.coverage [<test>] (and (|> (\\parser.result (<test> expected) {<json> expected}) - (!expect {try.#Success #1})) + (!expect {try.#Success .true})) (|> (\\parser.result (<test> expected) {<json> dummy}) - (!expect {try.#Success #0})))) + (!expect {try.#Success .false})))) (_.coverage [<check>] (and (|> (\\parser.result (<check> expected) {<json> expected}) (!expect {try.#Success _})) diff --git a/stdlib/source/test/lux/data/format/xml.lux b/stdlib/source/test/lux/data/format/xml.lux index 72a4a5665..c1d456cf1 100644 --- a/stdlib/source/test/lux/data/format/xml.lux +++ b/stdlib/source/test/lux/data/format/xml.lux @@ -90,7 +90,7 @@ _ \\parser.any] (in (symbol#= expected actual))) (list {/.#Node expected (dictionary.empty symbol.hash) (list)})) - (!expect {try.#Success #1})))) + (!expect {try.#Success .true})))) (do [! random.monad] [expected ..random_tag] (_.coverage [\\parser.node] diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index 8aead4f9b..66655823f 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -551,7 +551,7 @@ _ \\parser.any] (in (and (/#= input pre) (/#= right post))))) - (!expect {try.#Success #1})))) + (!expect {try.#Success .true})))) (do [! random.monad] [left (random.unicode 1) right (random.unicode 1) @@ -889,7 +889,7 @@ (/#= sample (/.together (list _l _r)))) _ - #0))) + false))) (_.coverage [/.clip /.clip_since] (|> [(/.clip 0 sizeL sample) (/.clip sizeL (nat.- sizeL (/.size sample)) sample) @@ -903,7 +903,7 @@ (/#= sample _f)) _ - #0))) + false))) )) (do [! random.monad] [sizeP bounded_size diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index c057aeaf0..661222696 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -32,7 +32,7 @@ (text#= parsed input) _ - #0))) + false))) (def (text_should_pass test regex input) (-> Text (Parser Text) Text Bit) diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index b03264c22..7c047318d 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -173,7 +173,7 @@ (case (/.as java/lang/Object sample) {.#Some _} true {.#None} false) (case (/.as java/lang/Object (/.null)) {.#Some _} false {.#None} true))) (_.coverage [/.synchronized] - (/.synchronized sample #1)) + (/.synchronized sample true)) (_.coverage [/.class_for] (text#= "java.lang.Class" (/.of_string (java/lang/Class::getName (/.class_for java/lang/Class))))) (_.coverage [/.null /.null?] @@ -183,13 +183,19 @@ (and (|> (/.??? (/.null)) (is (Maybe java/lang/Object)) (pipe.case - {.#None} #1 - {.#Some _} #0)) + {.#None} + true + + {.#Some _} + false)) (|> (/.??? sample) (is (Maybe java/lang/Object)) (pipe.case - {.#Some _} #1 - {.#None} #0)))) + {.#Some _} + true + + {.#None} + false)))) (_.coverage [/.!!!] (and (|> (/.??? (/.null)) /.!!! diff --git a/stdlib/source/test/lux/ffi.old.lux b/stdlib/source/test/lux/ffi.old.lux index e16dbd84d..117207e57 100644 --- a/stdlib/source/test/lux/ffi.old.lux +++ b/stdlib/source/test/lux/ffi.old.lux @@ -184,12 +184,18 @@ (_.coverage [/.???] (and (|> (is (Maybe java/lang/Object) (/.??? (/.null))) (pipe.case - {.#None} #1 - _ #0)) + {.#None} + true + + _ + false)) (|> (is (Maybe java/lang/Object) (/.??? sample)) (pipe.case - {.#Some _} #1 - _ #0)))) + {.#Some _} + true + + _ + false)))) (_.coverage [/.!!!] (and (/.null? (/.!!! (/.??? (/.null)))) (not (/.null? (/.!!! (/.??? sample)))))) @@ -208,7 +214,7 @@ (case (/.as java/lang/Object sample) {.#Some _} true {.#None} false) (case (/.as java/lang/Object (/.null)) {.#Some _} false {.#None} true))) (_.coverage [/.synchronized] - (/.synchronized sample #1)) + (/.synchronized sample true)) (_.coverage [/.class_for /.import] (|> (/.class_for java/lang/Class) java/lang/Class::getName diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index 7bcecdd8a..3cd03f84c 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -297,10 +297,10 @@ (_.coverage [/.module_exists?] (and (|> (/.module_exists? expected_current_module) (/.result expected_lux) - (!expect {try.#Success #1})) + (!expect {try.#Success .true})) (|> (/.module_exists? dummy_module) (/.result expected_lux) - (!expect {try.#Success #0})))) + (!expect {try.#Success .false})))) (_.coverage [/.modules] (|> /.modules (/.result expected_lux) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux index 09c976004..6a18983f0 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux @@ -140,13 +140,13 @@ [dummy random.bit] (_.coverage [\\parser.end?] (and (|> (\\parser.result \\parser.end? (list)) - (!expect {try.#Success #1})) + (!expect {try.#Success .true})) (|> (\\parser.result (do <>.monad [verdict \\parser.end? _ \\parser.bit] (in verdict)) (list (/.bit dummy))) - (!expect {try.#Success #0}))))) + (!expect {try.#Success .false}))))) (do [! random.monad] [dummy random.bit] (_.coverage [\\parser.end] diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis.lux index 91614f4b2..579356065 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis.lux @@ -125,11 +125,11 @@ can_analyse_unary! (`` (and (|> (do phase.monad - [it (|> (code.variant (list (code.nat 0) (code.bit #0) (` []))) + [it (|> (code.variant (list (code.nat 0) (code.bit false) (` []))) (/.phase ..expander archive.empty) (//type.expecting :variant:))] (in (case it - (//.variant [0 #0 (//.unit)]) + (//.variant [0 .false (//.unit)]) true _ @@ -167,11 +167,11 @@ can_analyse_nullary! (|> (do phase.monad [.let [:either: (Or .Any :record:)] - it (|> (code.variant (list (code.nat 0) (code.bit #0))) + it (|> (code.variant (list (code.nat 0) (code.bit false))) (/.phase ..expander archive.empty) (//type.expecting :either:))] (in (case it - (//.variant [0 #0 (//.unit)]) + (//.variant [0 .false (//.unit)]) true _ @@ -243,7 +243,7 @@ (in (and (type#= :variant: :it:) (case it - (//.variant [0 #0 (//.unit)]) + (//.variant [0 .false (//.unit)]) true _ @@ -293,7 +293,7 @@ (in (and (type#= :either: :it:) (case it - (//.variant [0 #0 (//.unit)]) + (//.variant [0 .false (//.unit)]) true _ @@ -739,9 +739,9 @@ (in (and (type#= .Frac :it:) (case it {//.#Case (//.bit bit/?) - [[//.#when (//pattern.bit #0) + [[//.#when (//pattern.bit .false) //.#then (//.frac false/?)] - (list [//.#when (//pattern.bit #1) + (list [//.#when (//pattern.bit .true) //.#then (//.frac true/?)])]} (and (same? bit/0 bit/?) (same? frac/0 false/?) @@ -809,9 +809,9 @@ (in (and (type#= .Frac :it:) (case it {//.#Case (//.tuple (list (//.bit bit/?) (//.nat nat/?))) - [[//.#when (//pattern.tuple (list (//pattern.bit #0) (//pattern.bind 0))) + [[//.#when (//pattern.tuple (list (//pattern.bit .false) (//pattern.bind 0))) //.#then (//.frac false/?)] - (list [//.#when (//pattern.tuple (list (//pattern.bit #1) (//pattern.bind 0))) + (list [//.#when (//pattern.tuple (list (//pattern.bit .true) (//pattern.bind 0))) //.#then (//.frac true/?)])]} (and (same? bit/0 bit/?) (same? nat/0 nat/?) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/complex.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/complex.lux index 46232997f..9e9004371 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/complex.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/complex.lux @@ -180,12 +180,12 @@ (//phase#each product.right) (//phase.result state) (try.else false)) - (and (sum? (type_literal (Maybe tagT)) 0 #0 (` [])) - (sum? (type_literal (Maybe tagT)) 0 #1 tagC)) - (and (sum? (type_literal (All (_ a) (Maybe a))) 0 #0 (` [])) - (not (sum? (type_literal (All (_ a) (Maybe a))) 0 #1 tagC))) - (and (sum? (type_literal (Ex (_ a) (Maybe a))) 0 #0 (` [])) - (sum? (type_literal (Ex (_ a) (Maybe a))) 0 #1 tagC))))) + (and (sum? (type_literal (Maybe tagT)) 0 false (` [])) + (sum? (type_literal (Maybe tagT)) 0 true tagC)) + (and (sum? (type_literal (All (_ a) (Maybe a))) 0 false (` [])) + (not (sum? (type_literal (All (_ a) (Maybe a))) 0 true tagC))) + (and (sum? (type_literal (Ex (_ a) (Maybe a))) 0 false (` [])) + (sum? (type_literal (Ex (_ a) (Maybe a))) 0 true tagC))))) (_.for [/.cannot_analyse_variant] (let [failure? (is (All (_ a) (-> (Exception a) (//analysis.Operation Any) Bit)) (function (_ exception analysis) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/reference.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/reference.lux index 7a209e6cf..6cc8db551 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/reference.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/reference.lux @@ -83,7 +83,7 @@ can_find_local_definition! (|> (do //phase.monad - [_ (//module.define expected_name {.#Definition [#0 expected_type []]})] + [_ (//module.define expected_name {.#Definition [false expected_type []]})] (/.reference "" ["" expected_name])) //type.inferring (//module.with 0 expected_module) @@ -102,7 +102,7 @@ can_find_foreign_definition! (|> (do //phase.monad [_ (//module.with 0 import - (//module.define expected_name {.#Definition [#1 expected_type []]})) + (//module.define expected_name {.#Definition [true expected_type []]})) _ (//module.import import)] (/.reference "" [import expected_name])) //type.inferring @@ -122,7 +122,7 @@ can_find_alias! (|> (do //phase.monad [_ (//module.with 0 import - (//module.define expected_name {.#Definition [#1 expected_type []]})) + (//module.define expected_name {.#Definition [true expected_type []]})) _ (//module.import import) _ (//module.define expected_name {.#Alias [import expected_name]})] (/.reference "" [expected_module expected_name])) @@ -142,7 +142,7 @@ can_find_type! (|> (do //phase.monad - [_ (//module.define expected_name {.#Type [#0 expected_type + [_ (//module.define expected_name {.#Type [false expected_type (if record? {.#Right [expected_label (list)]} {.#Left [expected_label (list)]})]})] @@ -182,8 +182,8 @@ (//phase.result state) (exception.otherwise (text.contains? (the exception.#label /.foreign_module_has_not_been_imported))) )))] - (and (scenario expected_type {.#Definition [#1 expected_type []]}) - (scenario .Type {.#Type [#1 expected_type + (and (scenario expected_type {.#Definition [true expected_type []]}) + (scenario .Type {.#Type [true expected_type (if record? {.#Right [expected_label (list)]} {.#Left [expected_label (list)]})]})))) @@ -201,8 +201,8 @@ (//phase.result state) (exception.otherwise (text.contains? (the exception.#label /.definition_has_not_been_exported))) )))] - (and (scenario expected_type {.#Definition [#0 expected_type []]}) - (scenario .Type {.#Type [#0 expected_type + (and (scenario expected_type {.#Definition [false expected_type []]}) + (scenario .Type {.#Type [false expected_type (if record? {.#Right [expected_label (list)]} {.#Left [expected_label (list)]})]})))) @@ -219,6 +219,6 @@ (//phase#each product.right) (//phase.result state) (exception.otherwise (text.contains? (the exception.#label /.labels_are_not_definitions))))))] - (and (scenario expected_type {.#Tag [#1 expected_type (list) 0]}) - (scenario expected_type {.#Slot [#1 expected_type (list) 0]})))) + (and (scenario expected_type {.#Tag [true expected_type (list) 0]}) + (scenario expected_type {.#Slot [true expected_type (list) 0]})))) )))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/synthesis.lux b/stdlib/source/test/lux/meta/compiler/language/lux/synthesis.lux index 2bfe91fca..4308c95bb 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/synthesis.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/synthesis.lux @@ -195,9 +195,9 @@ [dummy (at ! each (|>> synthesis.i64) random.i64)] (_.coverage [\\parser.end?] (and (|> (\\parser.result \\parser.end? (list)) - (!expect {try.#Success #1})) + (!expect {try.#Success .true})) (|> (\\parser.result (<>.before \\parser.any \\parser.end?) (list dummy)) - (!expect {try.#Success #0}))))) + (!expect {try.#Success .false}))))) (_.for [\\parser.cannot_parse] (all _.and ..simple diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux b/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux index 02d6402fb..c5bc1dfb5 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux @@ -83,10 +83,10 @@ archive.#output (sequence.sequence) archive.#registry registry.empty]]))] (and (let [cache (is (List /.Cache) - (list [#1 name/0 id/0 module/0 registry.empty]))] + (list [true name/0 id/0 module/0 registry.empty]))] (dictionary.empty? (/.purge cache order))) (let [cache (is (List /.Cache) - (list [#0 name/0 id/0 module/0 registry.empty]))] + (list [false name/0 id/0 module/0 registry.empty]))] (dictionary.key? (/.purge cache order) name/0)))) (let [order (is (dependency.Order Nat) (list [name/0 id/0 @@ -98,19 +98,19 @@ archive.#output (sequence.sequence) archive.#registry registry.empty]]))] (and (let [cache (is (List /.Cache) - (list [#1 name/0 id/0 module/0 registry.empty] - [#1 name/1 id/1 module/1 registry.empty])) + (list [true name/0 id/0 module/0 registry.empty] + [true name/1 id/1 module/1 registry.empty])) purge (/.purge cache order)] (dictionary.empty? purge)) (let [cache (is (List /.Cache) - (list [#1 name/0 id/0 module/0 registry.empty] - [#0 name/1 id/1 module/1 registry.empty])) + (list [true name/0 id/0 module/0 registry.empty] + [false name/1 id/1 module/1 registry.empty])) purge (/.purge cache order)] (and (not (dictionary.key? (/.purge cache order) name/0)) (dictionary.key? (/.purge cache order) name/1))) (let [cache (is (List /.Cache) - (list [#0 name/0 id/0 module/0 registry.empty] - [#1 name/1 id/1 module/1 registry.empty])) + (list [false name/0 id/0 module/0 registry.empty] + [true name/1 id/1 module/1 registry.empty])) purge (/.purge cache order)] (and (dictionary.key? (/.purge cache order) name/0) (dictionary.key? (/.purge cache order) name/1))))))) diff --git a/stdlib/source/test/lux/meta/symbol.lux b/stdlib/source/test/lux/meta/symbol.lux index 8644c6057..6972cd346 100644 --- a/stdlib/source/test/lux/meta/symbol.lux +++ b/stdlib/source/test/lux/meta/symbol.lux @@ -53,7 +53,7 @@ (_.property "Encoding a symbol without a module component results in text equal to the short of the symbol." (if (text.empty? module1) (same? short1 (at /.codec encoded symbol1)) - #1)))) + true)))) (_.coverage [/.separator] (let [it (at /.codec encoded symbol1)] diff --git a/stdlib/source/test/lux/meta/target/jvm.lux b/stdlib/source/test/lux/meta/target/jvm.lux index d526d3917..28fff6e38 100644 --- a/stdlib/source/test/lux/meta/target/jvm.lux +++ b/stdlib/source/test/lux/meta/target/jvm.lux @@ -133,7 +133,7 @@ (list) (list (/method.method ..method_modifier method_name - #0 (/type.method [(list) (list) ..$Object (list)]) + false (/type.method [(list) (list) ..$Object (list)]) (list) {.#Some (do /.monad [_ bytecode] @@ -877,11 +877,11 @@ {.#None} (/name.internal "java.lang.Object") (list) - (list (/field.field /field.static class_field #0 /type.long (sequence.sequence)) - (/field.field /field.public object_field #0 /type.long (sequence.sequence))) + (list (/field.field /field.static class_field false /type.long (sequence.sequence)) + (/field.field /field.public object_field false /type.long (sequence.sequence))) (list (/method.method /method.private constructor - #0 constructor::type + false constructor::type (list) {.#Some (do /.monad [_ /.aload_0 @@ -896,7 +896,7 @@ /method.public /method.static) static_method - #0 (/type.method [(list) (list) ..$Long (list)]) + false (/type.method [(list) (list) ..$Long (list)]) (list) {.#Some (do /.monad [_ (/.new $Self) @@ -1359,14 +1359,14 @@ (list) (list (/method.method ..method_modifier primitive_method_name - #0 primitive_method_type + false primitive_method_type (list) {.#Some (do /.monad [_ ((the #literal primitive) expected)] return)}) (/method.method ..method_modifier object_method_name - #0 (/type.method [(list) (list) (the #boxed primitive) (list)]) + false (/type.method [(list) (list) (the #boxed primitive) (list)]) (list) {.#Some (do /.monad [_ (/.invokestatic $Self primitive_method_name primitive_method_type) @@ -1645,7 +1645,7 @@ (function (_ name value) (/method.method /method.public name - #0 method::type + false method::type (list) {.#Some (do /.monad [_ (..$Long::literal value)] @@ -1658,7 +1658,7 @@ (list) (list) (list (/method.method (all /modifier#composite /method.public /method.abstract) - interface_method #0 method::type (list) {.#None})) + interface_method false method::type (list) {.#None})) (sequence.sequence)) try.trusted (binary.result /class.format)) @@ -1670,7 +1670,7 @@ (list) (list (/method.method /method.public "<init>" - #0 constructor::type + false constructor::type (list) {.#Some (do /.monad [_ /.aload_0 @@ -1679,7 +1679,7 @@ (method inherited_method part0) (method overriden_method fake_part2) (/method.method (all /modifier#composite /method.public /method.abstract) - abstract_method #0 method::type (list) {.#None})) + abstract_method false method::type (list) {.#None})) (sequence.sequence)) try.trusted (binary.result /class.format)) @@ -1696,7 +1696,7 @@ (list) (list (/method.method /method.public "<init>" - #0 constructor::type + false constructor::type (list) {.#Some (do /.monad [_ /.aload_0 @@ -1710,7 +1710,7 @@ /method.public /method.static) static_method - #0 (/type.method [(list) (list) ..$Long (list)]) + false (/type.method [(list) (list) ..$Long (list)]) (list) {.#Some (do /.monad [_ (/.new $Concrete) diff --git a/stdlib/source/test/lux/meta/type.lux b/stdlib/source/test/lux/meta/type.lux index f7e11f9f2..79432b2bc 100644 --- a/stdlib/source/test/lux/meta/type.lux +++ b/stdlib/source/test/lux/meta/type.lux @@ -402,10 +402,10 @@ (random.only (function (_ type) (case type (^.or {.#Sum _} {.#Product _}) - #0 + false _ - #1))) + true))) (list.repeated size) (monad.all !)) .let [(open "/#[0]") /.equivalence @@ -423,13 +423,18 @@ )) ))) (_.coverage [/.applied] - (and (<| (maybe.else #0) + (and (<| (maybe.else false) (do maybe.monad [partial (/.applied (list Bit) Ann) full (/.applied (list Int) partial)] (in (at /.equivalence = full {.#Product Bit Int})))) (|> (/.applied (list Bit) Text) - (pipe.case {.#None} #1 _ #0)))) + (pipe.case + {.#None} + true + + _ + false)))) (do [! random.monad] [size (|> random.nat (at ! each (n.% 3))) members (monad.all ! (list.repeated size (..random 0))) @@ -437,10 +442,10 @@ (random.only (function (_ type) (case type (^.or {.#Function _} {.#Apply _}) - #0 + false _ - #1)))) + true)))) .let [(open "/#[0]") /.equivalence (open "list#[0]") (list.equivalence /.equivalence)]] (all _.and @@ -458,10 +463,10 @@ (random.only (function (_ type) (case type (^.or {.#UnivQ _} {.#ExQ _}) - #0 + false _ - #1)))) + true)))) .let [(open "/#[0]") /.equivalence]] (`` (all _.and (,, (with_template [<ctor> <dtor>] @@ -487,7 +492,7 @@ (not (text#= array.primitive name)) _ - #1)))) + true)))) .let [(open "/#[0]") /.equivalence]] (all _.and (_.coverage [/.array /.flat_array] diff --git a/stdlib/source/test/lux/meta/type/check.lux b/stdlib/source/test/lux/meta/type/check.lux index a8d6bfb34..e1974368d 100644 --- a/stdlib/source/test/lux/meta/type/check.lux +++ b/stdlib/source/test/lux/meta/type/check.lux @@ -78,7 +78,7 @@ (list.every? valid_type? params) {.#Ex id} - #1 + true (^.with_template [<tag>] [{<tag> left right} @@ -90,7 +90,7 @@ (valid_type? type') _ - #0)) + false)) (def injection (Injection (All (_ a) (/.Check a))) |