aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorEduardo Julian2022-06-26 18:37:05 -0400
committerEduardo Julian2022-06-26 18:37:05 -0400
commit9f6505491e8a5c8a159ce094fe0af6f4fef0c5cf (patch)
treed497c163e477406a388460eedea80fdd6ee9748a /stdlib
parent3053fd79bc6ae42415298ee056a268dc2c9b690c (diff)
Re-named "format/lux/data/binary.Writer" to "Format".
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/source/documentation/lux.lux1712
-rw-r--r--stdlib/source/documentation/lux/abstract.lux4
-rw-r--r--stdlib/source/documentation/lux/abstract/apply.lux6
-rw-r--r--stdlib/source/documentation/lux/abstract/codec.lux6
-rw-r--r--stdlib/source/documentation/lux/abstract/comonad.lux10
-rw-r--r--stdlib/source/documentation/lux/abstract/comonad/cofree.lux16
-rw-r--r--stdlib/source/documentation/lux/abstract/comonad/free.lux17
-rw-r--r--stdlib/source/documentation/lux/abstract/enum.lux6
-rw-r--r--stdlib/source/documentation/lux/abstract/equivalence.lux6
-rw-r--r--stdlib/source/documentation/lux/abstract/functor.lux23
-rw-r--r--stdlib/source/documentation/lux/abstract/functor/contravariant.lux4
-rw-r--r--stdlib/source/documentation/lux/abstract/hash.lux11
-rw-r--r--stdlib/source/documentation/lux/abstract/interval.lux57
-rw-r--r--stdlib/source/documentation/lux/abstract/mix.lux17
-rw-r--r--stdlib/source/documentation/lux/abstract/monad.lux70
-rw-r--r--stdlib/source/documentation/lux/abstract/monad/free.lux13
-rw-r--r--stdlib/source/documentation/lux/abstract/monoid.lux13
-rw-r--r--stdlib/source/documentation/lux/abstract/order.lux52
-rw-r--r--stdlib/source/documentation/lux/abstract/predicate.lux56
-rw-r--r--stdlib/source/documentation/lux/control/concatenative.lux429
-rw-r--r--stdlib/source/documentation/lux/control/concurrency.lux2
-rw-r--r--stdlib/source/documentation/lux/control/concurrency/actor.lux89
-rw-r--r--stdlib/source/documentation/lux/control/concurrency/async.lux123
-rw-r--r--stdlib/source/documentation/lux/control/concurrency/atom.lux42
-rw-r--r--stdlib/source/documentation/lux/control/concurrency/frp.lux74
-rw-r--r--stdlib/source/documentation/lux/control/concurrency/semaphore.lux81
-rw-r--r--stdlib/source/documentation/lux/control/concurrency/stm.lux60
-rw-r--r--stdlib/source/documentation/lux/control/concurrency/thread.lux17
-rw-r--r--stdlib/source/documentation/lux/control/continuation.lux61
-rw-r--r--stdlib/source/documentation/lux/control/exception.lux104
-rw-r--r--stdlib/source/documentation/lux/control/function.lux57
-rw-r--r--stdlib/source/documentation/lux/control/function/contract.lux38
-rw-r--r--stdlib/source/documentation/lux/control/function/memo.lux37
-rw-r--r--stdlib/source/documentation/lux/control/function/mixin.lux69
-rw-r--r--stdlib/source/documentation/lux/control/function/mutual.lux65
-rw-r--r--stdlib/source/documentation/lux/control/io.lux35
-rw-r--r--stdlib/source/documentation/lux/control/lazy.lux24
-rw-r--r--stdlib/source/documentation/lux/control/maybe.lux66
-rw-r--r--stdlib/source/documentation/lux/control/parser.lux209
-rw-r--r--stdlib/source/documentation/lux/control/pipe.lux183
-rw-r--r--stdlib/source/documentation/lux/control/reader.lux52
-rw-r--r--stdlib/source/documentation/lux/control/region.lux60
-rw-r--r--stdlib/source/documentation/lux/control/remember.lux61
-rw-r--r--stdlib/source/documentation/lux/control/security.lux2
-rw-r--r--stdlib/source/documentation/lux/control/state.lux101
-rw-r--r--stdlib/source/documentation/lux/control/thread.lux66
-rw-r--r--stdlib/source/documentation/lux/control/try.lux81
-rw-r--r--stdlib/source/documentation/lux/control/writer.lux40
-rw-r--r--stdlib/source/documentation/lux/data/format/binary.lux8
-rw-r--r--stdlib/source/documentation/lux/data/format/tar.lux2
-rw-r--r--stdlib/source/format/lux/data/binary.lux58
-rw-r--r--stdlib/source/library/lux/data/format/tar.lux140
-rw-r--r--stdlib/source/library/lux/target/jvm/attribute.lux24
-rw-r--r--stdlib/source/library/lux/target/jvm/attribute/code.lux12
-rw-r--r--stdlib/source/library/lux/target/jvm/attribute/code/exception.lux14
-rw-r--r--stdlib/source/library/lux/target/jvm/attribute/constant.lux8
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode.lux6
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/address.lux12
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/environment.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux10
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux8
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux14
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/instruction.lux8
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/jump.lux8
-rw-r--r--stdlib/source/library/lux/target/jvm/class.lux40
-rw-r--r--stdlib/source/library/lux/target/jvm/constant.lux76
-rw-r--r--stdlib/source/library/lux/target/jvm/constant/pool.lux8
-rw-r--r--stdlib/source/library/lux/target/jvm/constant/tag.lux8
-rw-r--r--stdlib/source/library/lux/target/jvm/encoding/signed.lux16
-rw-r--r--stdlib/source/library/lux/target/jvm/encoding/unsigned.lux16
-rw-r--r--stdlib/source/library/lux/target/jvm/field.lux18
-rw-r--r--stdlib/source/library/lux/target/jvm/index.lux8
-rw-r--r--stdlib/source/library/lux/target/jvm/magic.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/method.lux18
-rw-r--r--stdlib/source/library/lux/target/jvm/modifier.lux8
-rw-r--r--stdlib/source/library/lux/target/jvm/version.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/default/platform.lux24
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux.lux18
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux16
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux18
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux54
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux12
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux22
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/export.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux2
-rw-r--r--stdlib/source/polytypic/lux/data/format/json.lux4
-rw-r--r--stdlib/source/program/aedifex/command/deploy/snapshot.lux2
-rw-r--r--stdlib/source/program/aedifex/command/install.lux2
-rw-r--r--stdlib/source/test/aedifex/command/deploy.lux2
-rw-r--r--stdlib/source/test/lux/data/binary.lux4
-rw-r--r--stdlib/source/test/lux/data/format/tar.lux18
-rw-r--r--stdlib/source/test/lux/extension.lux2
-rw-r--r--stdlib/source/test/lux/target/jvm.lux402
-rw-r--r--stdlib/source/test/lux/tool/compiler/meta/archive/module/descriptor.lux4
-rw-r--r--stdlib/source/test/lux/tool/compiler/meta/archive/module/document.lux4
-rw-r--r--stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux4
-rw-r--r--stdlib/source/test/lux/tool/compiler/meta/archive/signature.lux4
-rw-r--r--stdlib/source/test/lux/tool/compiler/meta/import.lux12
106 files changed, 2678 insertions, 2983 deletions
diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux
index 0bf71c4ad..0b0e815a7 100644
--- a/stdlib/source/documentation/lux.lux
+++ b/stdlib/source/documentation/lux.lux
@@ -2,7 +2,7 @@
[library
[lux
[program (.only program:)]
- ["$" documentation (.only documentation)]
+ ["$" documentation]
["[0]" debug]
[control
["[0]" io]]
@@ -37,879 +37,879 @@
["[1][0]" type]
["[1][0]" world]])
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- ""
- [(documentation /.prelude
- (format "The name of the prelude module"
- \n "Value: " (%.text /.prelude)))
+(.`` (.def .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [($.documentation /.prelude
+ (format "The name of the prelude module"
+ \n "Value: " (%.text /.prelude)))
- (documentation /.Any
- (format "The type of things whose type is irrelevant."
- \n "It can be used to write functions or data-structures that can take, or return, anything."))
+ ($.documentation /.Any
+ (format "The type of things whose type is irrelevant."
+ \n "It can be used to write functions or data-structures that can take, or return, anything."))
- (documentation /.Nothing
- (format "The type of things whose type is undefined."
- \n "Useful for expressions that cause errors or other 'extraordinary' conditions."))
+ ($.documentation /.Nothing
+ (format "The type of things whose type is undefined."
+ \n "Useful for expressions that cause errors or other 'extraordinary' conditions."))
- (documentation (/.List item)
- "A potentially empty list of values.")
+ ($.documentation (/.List item)
+ "A potentially empty list of values.")
- (documentation /.Bit
- "Your standard, run-of-the-mill boolean values (as #0 or #1 bits).")
+ ($.documentation /.Bit
+ "Your standard, run-of-the-mill boolean values (as #0 or #1 bits).")
- (documentation (/.I64 kind)
- "64-bit integers without any semantics.")
+ ($.documentation (/.I64 kind)
+ "64-bit integers without any semantics.")
- (documentation /.Nat
- (format "Natural numbers (unsigned integers)."
- \n "They start at zero (0) and extend in the positive direction."))
+ ($.documentation /.Nat
+ (format "Natural numbers (unsigned integers)."
+ \n "They start at zero (0) and extend in the positive direction."))
- (documentation /.Int
- "Your standard, run-of-the-mill integer numbers.")
+ ($.documentation /.Int
+ "Your standard, run-of-the-mill integer numbers.")
- (documentation /.Rev
- (format "Fractional numbers that live in the interval [0,1)."
- \n "Useful for probability, and other domains that work within that interval."))
+ ($.documentation /.Rev
+ (format "Fractional numbers that live in the interval [0,1)."
+ \n "Useful for probability, and other domains that work within that interval."))
- (documentation /.Frac
- "Your standard, run-of-the-mill floating-point (fractional) numbers.")
+ ($.documentation /.Frac
+ "Your standard, run-of-the-mill floating-point (fractional) numbers.")
- (documentation /.Text
- "Your standard, run-of-the-mill string values.")
+ ($.documentation /.Text
+ "Your standard, run-of-the-mill string values.")
- (documentation /.Symbol
- (format "A name for a Lux definition."
- \n "It includes the module of provenance."))
+ ($.documentation /.Symbol
+ (format "A name for a Lux definition."
+ \n "It includes the module of provenance."))
- (documentation (/.Maybe value)
- "A potentially missing value.")
+ ($.documentation (/.Maybe value)
+ "A potentially missing value.")
- (documentation /.Type
- "This type represents the data-structures that are used to specify types themselves.")
+ ($.documentation /.Type
+ "This type represents the data-structures that are used to specify types themselves.")
- (documentation /.Location
- "Locations are for specifying the location of Code nodes in Lux files during compilation.")
-
- (documentation (/.Ann meta_data datum)
- "The type of things that can be annotated with meta-data of arbitrary types.")
-
- (documentation /.Code
- "The type of Code nodes for Lux syntax.")
-
- (documentation /.private
- "The export policy for private/local definitions.")
-
- (documentation /.local
- "The export policy for private/local definitions.")
-
- (documentation /.public
- "The export policy for public/global definitions.")
-
- (documentation /.global
- "The export policy for public/global definitions.")
-
- (documentation /.Definition
- "Represents all the data associated with a definition: its type, its annotations, and its value.")
-
- (documentation /.Global
- "Represents all the data associated with a global constant.")
-
- (documentation (/.Either left right)
- "A choice between two values of different types.")
-
- (documentation /.Module
- "All the information contained within a Lux module.")
-
- (documentation /.Mode
- "A sign that shows the conditions under which the compiler is running.")
-
- (documentation /.Info
- "Information about the current version and type of compiler that is running.")
-
- (documentation /.Lux
- (format "Represents the state of the Lux compiler during a run."
- \n "It is provided to macros during their invocation, so they can access compiler data."
- \n "Caveat emptor: Avoid fiddling with it, unless you know what you're doing."))
-
- (documentation (/.Meta it)
- (format "Computations that can have access to the state of the compiler."
- \n "These computations may fail, or modify the state of the compiler."))
-
- (documentation /.Macro
- "Functions that run at compile-time and allow you to transform and extend the language in powerful ways.")
-
- (documentation /.comment
- (format "Throws away any code given to it."
- \n "Great for commenting-out code, while retaining syntax high-lighting and formatting in your text editor.")
- [(comment
- (def (this will not)
- (Be Defined)
- (because it will be (commented out))))])
-
- (documentation /.All
- "Universal quantification."
- [(All (_ a)
- (-> a a))]
- ["A name can be provided, to specify a recursive type."
- (All (List a)
- (Or Any
- [a (List a)]))])
-
- (documentation /.Ex
- "Existential quantification."
- [(Ex (_ a)
- [(Codec Text a) a])]
- ["A name can be provided, to specify a recursive type."
- (Ex (Self a)
- [(Codec Text a)
- a
- (List (Self a))])])
-
- (documentation /.->
- "Function types."
- ["This is the type of a function that takes 2 Ints and returns an Int."
- (-> Int Int Int)])
-
- (documentation /.list
- "List literals."
- [(is (List Nat)
- (list 0 1 2 3))])
-
- (documentation /.Union
- "Union types."
- [(Union Bit Nat Text)]
- [(= Nothing
- (Union))])
-
- (documentation /.Tuple
- "Tuple types."
- [(Tuple Bit Nat Text)]
- [(= Any
- (Tuple))])
-
- (documentation /.Or
- "An alias for the Union type constructor."
- [(= (Union Bit Nat Text)
- (Or Bit Nat Text))]
- [(= (Union)
- (Or))])
-
- (documentation /.And
- "An alias for the Tuple type constructor."
- [(= (Tuple Bit Nat Text)
- (And Bit Nat Text))]
- [(= (Tuple)
- (And))])
-
- (documentation /.left
- "Left-association for the application of binary functions over variadic arguments."
- [(left text#composite "Hello, " name ". How are you?")
- "=>"
- (text#composite (text#composite "Hello, " name) ". How are you?")])
-
- (documentation /.all
- "Right-association for the application of binary functions over variadic arguments."
- [(all text#composite "Hello, " name ". How are you?")
- "=>"
- (text#composite "Hello, " (text#composite name ". How are you?"))])
-
- (documentation /.if
- "Picks which expression to evaluate based on a bit test value."
- [(if #1
- "Oh, yeah!"
- "Aw hell naw!")
- "=>"
- "Oh, yeah!"]
- [(if #0
- "Oh, yeah!"
- "Aw hell naw!")
- "=>"
- "Aw hell naw!"])
-
- (documentation /.Primitive
- "Macro to treat define new primitive types."
- [(Primitive "java.lang.Object")]
- [(Primitive "java.util.List" [(Primitive "java.lang.Long")])])
-
- (documentation /.`
- (format "Hygienic quasi-quotation as a macro."
- \n "Unquote (~) and unquote-splice (~+) must also be used as forms."
- \n "All unprefixed macros will receive their parent module's prefix if imported; otherwise will receive the prefix of the module on which the quasi-quote is being used.")
- [(` (def (~ name)
- (function ((~' _) (~+ args))
- (~ body))))])
-
- (documentation /.`'
- (format "Unhygienic quasi-quotation as a macro."
- \n "Unquote (~) and unquote-splice (~+) must also be used as forms.")
- [(`' (def (~ name)
- (function (_ (~+ args))
- (~ body))))])
-
- (documentation /.'
- "Quotation as a macro."
- [(' YOLO)])
-
- (documentation /.|>
- "Piping macro."
- [(|> elems
- (list#each int#encoded)
- (interposed " ")
- (mix text#composite ""))
- "=>"
- (mix text#composite ""
- (interposed " "
- (list#each int#encoded
- elems)))])
-
- (documentation /.<|
- "Reverse piping macro."
- [(<| (mix text#composite "")
- (interposed " ")
- (list#each int#encoded)
- elems)
- "=>"
- (mix text#composite ""
- (interposed " "
- (list#each int#encoded
- elems)))])
-
- (documentation /.template
- ""
- ["By specifying a pattern (with holes), and the input data to fill those holes, repeats the pattern as many times as necessary."
- (with_template [<name> <diff>]
- [(def .public <name>
- (-> Int Int)
- (+ <diff>))]
-
- [++ +1]
- [-- -1]
- )])
-
- (documentation /.not
- "Bit negation."
- [(not #1)
- "=>"
- #0]
- [(not #0)
- "=>"
- #1])
-
- (documentation /.type
- "Takes a type expression and returns its representation as data-structure."
- [(type_literal (All (_ a)
- (Maybe (List a))))])
-
- (documentation /.is
- "The type-annotation macro."
- [(is (List Int)
- (list +1 +2 +3))])
-
- (documentation /.as
- "The type-coercion macro."
- [(as Dinosaur
- (list +1 +2 +3))])
-
- (documentation /.Rec
- "Parameter-less recursive types."
- ["A name has to be given to the whole type, to use it within its body."
- (Rec Int_List
- (Or Any
- [Int Int_List]))]
- ["Can also be used with type and labelled-type definitions."
- (type Type
- (Rec @
- (Variant
- {#Primitive Text (List @)}
- {#Sum @ @}
- {#Product @ @}
- {#Function @ @}
- {#Parameter Nat}
- {#Var Nat}
- {#Ex Nat}
- {#UnivQ (List @) @}
- {#ExQ (List @) @}
- {#Apply @ @}
- {#Named Symbol @})))])
-
- (documentation /.exec
- "Sequential execution of expressions (great for side-effects)."
- [(exec
- (log! "#1")
- (log! "#2")
- (log! "#3")
- "YOLO")])
-
- (documentation /.case
- (format "The pattern-matching macro."
- \n "Allows the usage of macros within the patterns to provide custom syntax.")
- [(case (is (List Int)
- (list +1 +2 +3))
- {#Item x {#Item y {#Item z {#End}}}}
- {#Some (all * x y z)}
-
- _
- {#None})])
-
- (documentation /.pattern
- (format "Macro-expanding patterns."
- \n "It's a special macro meant to be used with 'case'.")
- [(case (is (List Int)
- (list +1 +2 +3))
- (pattern (list x y z))
- {#Some (all * x y z)}
-
- _
- {#None})])
-
- ... (documentation /.^or
- ... (format "Or-patterns."
- ... \n "It's a special macro meant to be used with 'case'.")
- ... [(type Weekday
- ... (Variant
- ... {#Monday}
- ... {#Tuesday}
- ... {#Wednesday}
- ... {#Thursday}
- ... {#Friday}
- ... {#Saturday}
- ... {#Sunday}))
-
- ... (def (weekend? day)
- ... (-> Weekday Bit)
- ... (case day
- ... (^or {#Saturday} {#Sunday})
- ... #1
-
- ... _
- ... #0))])
-
- (documentation /.let
- (format "Creates local bindings."
- \n "Can (optionally) use pattern-matching macros when binding.")
- [(let [x (foo bar)
- y (baz quux)]
- (op x y))])
-
- (documentation /.function
- "Syntax for creating functions."
- [(is (All (_ a b)
- (-> a b a))
- (function (_ x y)
- x))]
- ["Allows for giving the function itself a name, for the sake of recursion."
- (is (-> Nat Nat)
- (function (factorial n)
- (case n
- 0 1
- _ (* n (factorial (-- n))))))])
-
- (documentation /.def
- "Defines global constants/functions."
- [(def branching_exponent
- Int
- +5)]
- ["The type is optional."
- (def branching_exponent
- +5)]
- [(def (pair_list pair)
- (-> [Code Code] (List Code))
- (let [[left right] pair]
- (list left right)))]
- ["Can pattern-match on the inputs to functions."
- (def (pair_list [left right])
- (-> [Code Code] (List Code))
- (list left right))])
-
- (documentation /.macro
- "Macro-definition macro."
- [(def .public symbol
- (macro (_ tokens)
- (case tokens
- (^with_template [<tag>]
- [(pattern (list [_ {<tag> [module name]}]))
- (in (list (` [(~ (text$ module)) (~ (text$ name))])))])
- ([#Symbol])
-
- _
- (failure "Wrong syntax for symbol"))))])
-
- (documentation /.and
- "Short-circuiting 'and'."
- [(and #1 #0)
- "=>"
- #0]
- [(and #1 #1)
- "=>"
- #1])
-
- (documentation /.or
- "Short-circuiting 'or'."
- [(or #1 #0)
- "=>"
- #1]
- [(or #0 #0)
- "=>"
- #0])
-
- (documentation /.panic!
- "Causes an error, with the given error message."
- [(panic! "OH NO!")])
-
- (documentation /.implementation
- "Express a value that implements an interface."
- [(is (Order Int)
- (implementation
- (def equivalence
- equivalence)
- (def (< reference subject)
- (< reference subject))
- ))])
-
- (documentation /.Variant
- (format "Syntax for defining labelled/tagged sum/union types."
- \n "WARNING: Only use it within the type macro.")
- [(type Referrals
- (Variant
- {#All}
- {#Only (List Text)}
- {#Exclude (List Text)}
- {#Ignore}
- {#Nothing}))])
-
- (documentation /.Record
- (format "Syntax for defining labelled/slotted product/tuple types."
- \n "WARNING: Only use it within the type macro.")
- [(type Refer
- (Record
- [#refer_defs Referrals
- #refer_open (List Openings)]))])
-
- (documentation /.type
- "The type-definition macro."
- [(type (List a)
- {#End}
- {#Item a (List a)})])
-
- (documentation /.Interface
- "Interface definition."
- [(type .public (Order a)
- (Interface
- (is (Equivalence a)
- equivalence)
- (is (-> a a Bit)
- <)))])
-
- (.with_template [<name>]
- [(documentation <name>
- "Safe type-casting for I64 values.")]
-
- [/.i64]
- [/.nat]
- [/.int]
- [/.rev]
- )
-
- (documentation /.module_separator
- (format "Character used to separate the parts of module names."
- \n "Value: " (%.text /.module_separator)))
-
- (documentation /.open
- (format "Same as the 'open' macro, but meant to be used as a pattern-matching macro for generating local bindings."
- \n "Takes an 'alias' text for the generated local bindings.")
- [(def .public (range enum from to)
- (All (_ a) (-> (Enum a) a a (List a)))
- (let [(open "[0]") enum]
- (loop (again [end to
- output {.#End}])
- (cond (< end from)
- (again (pred end) {.#Item end output})
-
- (< from end)
- (again (succ end) {.#Item end output})
-
- ... (= end from)
- {.#Item end output}))))])
-
- (documentation /.cond
- "Conditional branching with multiple test conditions."
- [(cond (even? num) "WHEN even"
- (odd? num) "WHEN odd"
- "ELSE")])
-
- (documentation /.the
- "Accesses the value of a record at a given tag."
- [(the #field my_record)]
- ["Can also work with multiple levels of nesting."
- (the [#foo #bar #baz] my_record)]
- ["And, if only the slot/path is given, generates an accessor function."
- (let [getter (the [#foo #bar #baz])]
- (getter my_record))])
-
- (documentation /.use
- "Opens a implementation and generates a definition for each of its members (including nested members)."
- [(use "i:[0]" order)
- "=>"
- (def i:= (at order =))
- (def i:< (at order <))])
-
- (documentation /.|>>
- "Similar to the piping macro, but rather than taking an initial object to work on, creates a function for taking it."
- [(|>> (list#each int#encoded)
- (interposed " ")
- (mix text#composite ""))
- "=>"
- (function (_ <it>)
- (mix text#composite ""
- (interposed " "
- (list#each int#encoded <it>))))])
-
- (documentation /.<<|
- "Similar to the reverse piping macro, but rather than taking an initial object to work on, creates a function for taking it."
- [(<<| (mix text#composite "")
- (interposed " ")
- (list#each int#encoded))
- "=>"
- (function (_ <it>)
- (mix text#composite ""
- (interposed " "
- (list#each int#encoded
- <it>))))])
-
- (documentation /.require
- "Module-definition macro."
- [(.require
- [lux (.except)
- [control
- ["M" monad (.except)]]
- [data
- maybe
- ["[0]" name (.use "[1]#[0]" codec)]]
- [macro
- code]]
- [//
- [type (.use "[0]" equivalence)]])])
-
- (documentation /.#
- "Allows accessing the value of a implementation's member."
- [(at codec encoded)]
- ["Also allows using that value as a function."
- (at codec encoded +123)])
-
- (documentation /.has
- "Sets the value of a record at a given tag."
- [(has #name "Lux" lang)]
- ["Can also work with multiple levels of nesting."
- (has [#foo #bar #baz] value my_record)]
- ["And, if only the slot/path and (optionally) the value are given, generates a mutator function."
- (let [setter (has [#foo #bar #baz] value)]
- (setter my_record))
- (let [setter (has [#foo #bar #baz])]
- (setter value my_record))])
-
- (documentation /.revised
- "Modifies the value of a record at a given tag, based on some function."
- [(revised #age ++ person)]
- ["Can also work with multiple levels of nesting."
- (revised [#foo #bar #baz] func my_record)]
- ["And, if only the slot/path and (optionally) the value are given, generates a mutator function."
- (let [updater (revised [#foo #bar #baz] func)]
- (updater my_record))
- (let [updater (revised [#foo #bar #baz])]
- (updater func my_record))])
-
- ... (documentation /.^template
- ... "It's similar to template, but meant to be used during pattern-matching."
- ... [(def (reduced env type)
- ... (-> (List Type) Type Type)
- ... (case type
- ... {.#Primitive name params}
- ... {.#Primitive name (list#each (reduced env) params)}
-
- ... (^with_template [<tag>]
- ... [{<tag> left right}
- ... {<tag> (reduced env left) (reduced env right)}])
- ... ([.#Sum] [.#Product])
-
- ... (^with_template [<tag>]
- ... [{<tag> left right}
- ... {<tag> (reduced env left) (reduced env right)}])
- ... ([.#Function] [.#Apply])
-
- ... (^with_template [<tag>]
- ... [{<tag> old_env def}
- ... (case old_env
- ... {.#End}
- ... {<tag> env def}
-
- ... _
- ... type)])
- ... ([.#UnivQ] [.#ExQ])
-
- ... {.#Parameter idx}
- ... (else type (list.item idx env))
-
- ... _
- ... type
- ... ))])
-
- (.with_template [<name> <doc>]
- [(documentation <name>
- <doc>)]
-
- [/.++ "Increment function."]
- [/.-- "Decrement function."]
- )
-
- (documentation /.loop
- (format "Allows arbitrary looping, using the 'again' form to re-start the loop."
- \n "Can be used in monadic code to create monadic loops.")
- [(loop (again [count +0
- x init])
- (if (< +10 count)
- (again (++ count) (f x))
- x))]
- ["Loops can also be given custom names."
- (loop (my_loop [count +0
- x init])
- (if (< +10 count)
- (my_loop (++ count) (f x))
- x))])
-
- (documentation /.with_expansions
- (format "Controlled macro-expansion."
- \n "Bind an arbitraty number of Code nodes resulting from macro-expansion to local bindings."
- \n "Wherever a binding appears, the bound Code nodes will be spliced in there.")
- [(def test
- Test
- (with_expansions
- [<tests> (with_template [<function> <parameter> <expected>]
- [(cover [<function>]
- (compare <text>
- (at codec encoded <function> <parameter>)))]
-
- [bit #1 "#1"]
- [int +123 "+123"]
- [frac +123.0 "+123.0"]
- [text "123" "'123'"]
- [symbol ["yolo" "lol"] "yolo.lol"]
- [form (list (bit #1)) "(#1)"]
- [tuple (list (bit #1)) "[#1]"]
- )]
- (all and
- <tests>
- )))])
-
- (documentation /.static
- (format "Resolves the names of definitions to their values at compile-time, assuming their values are either:"
- \n "* Bit"
- \n "* Nat"
- \n "* Int"
- \n "* Rev"
- \n "* Frac"
- \n "* Text")
- [(def my_nat 123)
- (def my_text "456")
- (and (case [my_nat my_text]
- (pattern (static [..my_nat ..my_text]))
- true
+ ($.documentation /.Location
+ "Locations are for specifying the location of Code nodes in Lux files during compilation.")
+
+ ($.documentation (/.Ann meta_data datum)
+ "The type of things that can be annotated with meta-data of arbitrary types.")
+
+ ($.documentation /.Code
+ "The type of Code nodes for Lux syntax.")
+
+ ($.documentation /.private
+ "The export policy for private/local definitions.")
+
+ ($.documentation /.local
+ "The export policy for private/local definitions.")
+
+ ($.documentation /.public
+ "The export policy for public/global definitions.")
+
+ ($.documentation /.global
+ "The export policy for public/global definitions.")
+
+ ($.documentation /.Definition
+ "Represents all the data associated with a definition: its type, its annotations, and its value.")
+
+ ($.documentation /.Global
+ "Represents all the data associated with a global constant.")
+
+ ($.documentation (/.Either left right)
+ "A choice between two values of different types.")
+
+ ($.documentation /.Module
+ "All the information contained within a Lux module.")
+
+ ($.documentation /.Mode
+ "A sign that shows the conditions under which the compiler is running.")
+
+ ($.documentation /.Info
+ "Information about the current version and type of compiler that is running.")
+
+ ($.documentation /.Lux
+ (format "Represents the state of the Lux compiler during a run."
+ \n "It is provided to macros during their invocation, so they can access compiler data."
+ \n "Caveat emptor: Avoid fiddling with it, unless you know what you're doing."))
+
+ ($.documentation (/.Meta it)
+ (format "Computations that can have access to the state of the compiler."
+ \n "These computations may fail, or modify the state of the compiler."))
+
+ ($.documentation /.Macro
+ "Functions that run at compile-time and allow you to transform and extend the language in powerful ways.")
+
+ ($.documentation /.comment
+ (format "Throws away any code given to it."
+ \n "Great for commenting-out code, while retaining syntax high-lighting and formatting in your text editor.")
+ [(comment
+ (def (this will not)
+ (Be Defined)
+ (because it will be (commented out))))])
+
+ ($.documentation /.All
+ "Universal quantification."
+ [(All (_ a)
+ (-> a a))]
+ ["A name can be provided, to specify a recursive type."
+ (All (List a)
+ (Or Any
+ [a (List a)]))])
+
+ ($.documentation /.Ex
+ "Existential quantification."
+ [(Ex (_ a)
+ [(Codec Text a) a])]
+ ["A name can be provided, to specify a recursive type."
+ (Ex (Self a)
+ [(Codec Text a)
+ a
+ (List (Self a))])])
+
+ ($.documentation /.->
+ "Function types."
+ ["This is the type of a function that takes 2 Ints and returns an Int."
+ (-> Int Int Int)])
+
+ ($.documentation /.list
+ "List literals."
+ [(is (List Nat)
+ (list 0 1 2 3))])
+
+ ($.documentation /.Union
+ "Union types."
+ [(Union Bit Nat Text)]
+ [(= Nothing
+ (Union))])
+
+ ($.documentation /.Tuple
+ "Tuple types."
+ [(Tuple Bit Nat Text)]
+ [(= Any
+ (Tuple))])
+
+ ($.documentation /.Or
+ "An alias for the Union type constructor."
+ [(= (Union Bit Nat Text)
+ (Or Bit Nat Text))]
+ [(= (Union)
+ (Or))])
+
+ ($.documentation /.And
+ "An alias for the Tuple type constructor."
+ [(= (Tuple Bit Nat Text)
+ (And Bit Nat Text))]
+ [(= (Tuple)
+ (And))])
+
+ ($.documentation /.left
+ "Left-association for the application of binary functions over variadic arguments."
+ [(left text#composite "Hello, " name ". How are you?")
+ "=>"
+ (text#composite (text#composite "Hello, " name) ". How are you?")])
+
+ ($.documentation /.all
+ "Right-association for the application of binary functions over variadic arguments."
+ [(all text#composite "Hello, " name ". How are you?")
+ "=>"
+ (text#composite "Hello, " (text#composite name ". How are you?"))])
+
+ ($.documentation /.if
+ "Picks which expression to evaluate based on a bit test value."
+ [(if #1
+ "Oh, yeah!"
+ "Aw hell naw!")
+ "=>"
+ "Oh, yeah!"]
+ [(if #0
+ "Oh, yeah!"
+ "Aw hell naw!")
+ "=>"
+ "Aw hell naw!"])
+
+ ($.documentation /.Primitive
+ "Macro to treat define new primitive types."
+ [(Primitive "java.lang.Object")]
+ [(Primitive "java.util.List" [(Primitive "java.lang.Long")])])
+
+ ($.documentation /.`
+ (format "Hygienic quasi-quotation as a macro."
+ \n "Unquote (~) and unquote-splice (~+) must also be used as forms."
+ \n "All unprefixed macros will receive their parent module's prefix if imported; otherwise will receive the prefix of the module on which the quasi-quote is being used.")
+ [(` (def (~ name)
+ (function ((~' _) (~+ args))
+ (~ body))))])
+
+ ($.documentation /.`'
+ (format "Unhygienic quasi-quotation as a macro."
+ \n "Unquote (~) and unquote-splice (~+) must also be used as forms.")
+ [(`' (def (~ name)
+ (function (_ (~+ args))
+ (~ body))))])
+
+ ($.documentation /.'
+ "Quotation as a macro."
+ [(' YOLO)])
+
+ ($.documentation /.|>
+ "Piping macro."
+ [(|> elems
+ (list#each int#encoded)
+ (interposed " ")
+ (mix text#composite ""))
+ "=>"
+ (mix text#composite ""
+ (interposed " "
+ (list#each int#encoded
+ elems)))])
+
+ ($.documentation /.<|
+ "Reverse piping macro."
+ [(<| (mix text#composite "")
+ (interposed " ")
+ (list#each int#encoded)
+ elems)
+ "=>"
+ (mix text#composite ""
+ (interposed " "
+ (list#each int#encoded
+ elems)))])
+
+ ($.documentation /.template
+ ""
+ ["By specifying a pattern (with holes), and the input data to fill those holes, repeats the pattern as many times as necessary."
+ (with_template [<name> <diff>]
+ [(def .public <name>
+ (-> Int Int)
+ (+ <diff>))]
+
+ [++ +1]
+ [-- -1]
+ )])
+
+ ($.documentation /.not
+ "Bit negation."
+ [(not #1)
+ "=>"
+ #0]
+ [(not #0)
+ "=>"
+ #1])
+
+ ($.documentation /.type
+ "Takes a type expression and returns its representation as data-structure."
+ [(type_literal (All (_ a)
+ (Maybe (List a))))])
+
+ ($.documentation /.is
+ "The type-annotation macro."
+ [(is (List Int)
+ (list +1 +2 +3))])
+
+ ($.documentation /.as
+ "The type-coercion macro."
+ [(as Dinosaur
+ (list +1 +2 +3))])
+
+ ($.documentation /.Rec
+ "Parameter-less recursive types."
+ ["A name has to be given to the whole type, to use it within its body."
+ (Rec Int_List
+ (Or Any
+ [Int Int_List]))]
+ ["Can also be used with type and labelled-type definitions."
+ (type Type
+ (Rec @
+ (Variant
+ {#Primitive Text (List @)}
+ {#Sum @ @}
+ {#Product @ @}
+ {#Function @ @}
+ {#Parameter Nat}
+ {#Var Nat}
+ {#Ex Nat}
+ {#UnivQ (List @) @}
+ {#ExQ (List @) @}
+ {#Apply @ @}
+ {#Named Symbol @})))])
+
+ ($.documentation /.exec
+ "Sequential execution of expressions (great for side-effects)."
+ [(exec
+ (log! "#1")
+ (log! "#2")
+ (log! "#3")
+ "YOLO")])
+
+ ($.documentation /.case
+ (format "The pattern-matching macro."
+ \n "Allows the usage of macros within the patterns to provide custom syntax.")
+ [(case (is (List Int)
+ (list +1 +2 +3))
+ {#Item x {#Item y {#Item z {#End}}}}
+ {#Some (all * x y z)}
_
- false)
- (case [my_nat my_text]
- (pattern [(static ..my_nat) (static ..my_text)])
- true
+ {#None})])
+
+ ($.documentation /.pattern
+ (format "Macro-expanding patterns."
+ \n "It's a special macro meant to be used with 'case'.")
+ [(case (is (List Int)
+ (list +1 +2 +3))
+ (pattern (list x y z))
+ {#Some (all * x y z)}
_
- false))])
-
- ... (documentation /.^multi
- ... (format "Multi-level pattern matching."
- ... \n "Useful in situations where the result of a branch depends on further refinements on the values being matched.")
- ... [(case (split (size static) uri)
- ... (^multi {#Some [chunk uri']}
- ... [(text#= static chunk) #1])
- ... (match_uri endpoint? parts' uri')
-
- ... _
- ... {#Left (format "Static part " (%t static) " does not match URI: " uri)})]
- ... ["Short-cuts can be taken when using bit tests."
- ... "The example above can be rewritten as..."
- ... (case (split (size static) uri)
- ... (^multi {#Some [chunk uri']}
- ... (text#= static chunk))
- ... (match_uri endpoint? parts' uri')
-
- ... _
- ... {#Left (format "Static part " (%t static) " does not match URI: " uri)})])
-
- (documentation /.symbol
- "Gives back a 2 tuple with the module and name parts, both as Text."
- [(symbol ..#doc)
- "=>"
- ["documentation/lux" "#doc"]])
-
- (documentation /.parameter
- (format "WARNING: Please stay away from this macro; it's very likely to be removed in a future version of Lux."
- "Allows you to refer to the type-variables in a polymorphic function's type, by their index.")
- ["In the example below, 0 corresponds to the 'a' variable."
- (def .public (of_list list)
- (All (_ a) (-> (List a) (Sequence a)))
- (list#mix add
- (is (Sequence (parameter 0))
- empty)
- list))])
-
- (documentation /.same?
- "Tests whether the 2 values are identical (not just 'equal')."
- ["This one should succeed:"
- (let [value +5]
- (same? value
- value))]
- ["This one should fail:"
- (same? +5
- (+ +2 +3))])
-
- ... (documentation /.^let
- ... "Allows you to simultaneously bind and de-structure a value."
- ... [(def (hash (^let set [member_hash _]))
- ... (list#mix (function (_ elem acc)
- ... (+ acc
- ... (at member_hash hash elem)))
- ... 0
- ... (set.list set)))])
-
- ... (documentation /.^|>
- ... "Pipes the value being pattern-matched against prior to binding it to a variable."
- ... [(case input
- ... (^|> value [++ (% 10) (max 1)])
- ... (foo value))])
-
- (documentation /.as_expected
- "Coerces the given expression to the type of whatever is expected."
- [(is Dinosaur
- (as_expected (is (List Nat)
- (list 1 2 3))))])
-
- (documentation /.undefined
- (format "Meant to be used as a stand-in for functions with undefined implementations."
- \n "Undefined expressions will type-check against everything, so they make good dummy implementations."
- \n "However, if an undefined expression is ever evaluated, it will raise a runtime error.")
- [(def (square x)
- (-> Int Int)
- (undefined))])
-
- (documentation /.type_of
- "Generates the type corresponding to a given expression."
- [(let [my_num +123]
- (type_of my_num))
- "=="
- Int]
- [(type_of +123)
- "=="
- Int])
-
- (documentation /.template
- (format "Define macros in the style of with_template."
- \n "For simple macros that do not need any fancy features.")
- [(def square
- (template (square x)
- (* x x)))])
-
- (documentation /.these
- (format "Given a (potentially empty) list of codes, just returns them immediately, without any work done."
- \n "This may seen useless, but it has its utility when dealing with controlled-macro-expansion macros.")
- [(with_expansions [<operands> (these 1
- 2
- 3
- 4)]
- (all + <operands>))])
-
- (documentation /.char
- "If given a 1-character text literal, yields the char-code of the sole character."
- [(is Nat
- (char "A"))
- "=>"
- 65])
-
- (documentation /.for
- (format "Selects the appropriate code for a given target-platform when compiling Lux to it."
- \n "Look-up the available targets in library/lux/target.")
- [(def js
- "JavaScript")
-
- (for "JVM" (do jvm stuff)
- js (do js stuff)
- (do default stuff))])
-
- (documentation /.``
- (format "Delimits a controlled (spliced) macro-expansion."
- \n "Uses a (~~) special form to specify where to expand.")
- [(`` (some expression
- (~~ (some macro which may yield 0 or more results))))])
-
- ... (documentation /.^code
- ... "Generates pattern-matching code for Code values in a way that looks like code-templating."
- ... [(is (Maybe Nat)
- ... (case (` (#0 123 +456.789))
- ... (^code (#0 (~ [_ {.#Nat number}]) +456.789))
- ... {.#Some number}
-
- ... _
- ... {.#None}))])
-
- (documentation /.false
- "The boolean FALSE value.")
-
- (documentation /.true
- "The boolean TRUE value.")
-
- (documentation /.try
- ""
- [(is Foo
- (case (is (Either Text Bar)
- (try (is Bar
- (risky computation which may panic))))
- {.#Right success}
- (is Foo
- (do something after success))
-
- {.#Left error}
- (is Foo
- (recover from error))))])
-
- ($.default (/.Code' w))
- ($.default /.Alias)
- ($.default (/.Bindings key value))
- ($.default /.Ref)
- ($.default /.Scope)
- ($.default /.Source)
- ($.default /.Module_State)
- ($.default /.Type_Context)
- ($.default /.Macro')
- ($.default /.Label)
- ($.default /.macro)]
- [/abstract.documentation
- /control.documentation
- /data.documentation
- /debug.documentation
- /documentation.documentation
- /extension.documentation
- /ffi.documentation
- /locale.documentation
- /macro.documentation
- /math.documentation
- /meta.documentation
- /program.documentation
- /static.documentation
- /target.documentation
- /test.documentation
- /time.documentation
- /tool.documentation
- /type.documentation
- /world.documentation]))
+ {#None})])
+
+ ... ($.documentation /.^or
+ ... (format "Or-patterns."
+ ... \n "It's a special macro meant to be used with 'case'.")
+ ... [(type Weekday
+ ... (Variant
+ ... {#Monday}
+ ... {#Tuesday}
+ ... {#Wednesday}
+ ... {#Thursday}
+ ... {#Friday}
+ ... {#Saturday}
+ ... {#Sunday}))
+
+ ... (def (weekend? day)
+ ... (-> Weekday Bit)
+ ... (case day
+ ... (^or {#Saturday} {#Sunday})
+ ... #1
+
+ ... _
+ ... #0))])
+
+ ($.documentation /.let
+ (format "Creates local bindings."
+ \n "Can (optionally) use pattern-matching macros when binding.")
+ [(let [x (foo bar)
+ y (baz quux)]
+ (op x y))])
+
+ ($.documentation /.function
+ "Syntax for creating functions."
+ [(is (All (_ a b)
+ (-> a b a))
+ (function (_ x y)
+ x))]
+ ["Allows for giving the function itself a name, for the sake of recursion."
+ (is (-> Nat Nat)
+ (function (factorial n)
+ (case n
+ 0 1
+ _ (* n (factorial (-- n))))))])
+
+ ($.documentation /.def
+ "Defines global constants/functions."
+ [(def branching_exponent
+ Int
+ +5)]
+ ["The type is optional."
+ (def branching_exponent
+ +5)]
+ [(def (pair_list pair)
+ (-> [Code Code] (List Code))
+ (let [[left right] pair]
+ (list left right)))]
+ ["Can pattern-match on the inputs to functions."
+ (def (pair_list [left right])
+ (-> [Code Code] (List Code))
+ (list left right))])
+
+ ($.documentation /.macro
+ "Macro-definition macro."
+ [(def .public symbol
+ (macro (_ tokens)
+ (case tokens
+ (^with_template [<tag>]
+ [(pattern (list [_ {<tag> [module name]}]))
+ (in (list (` [(~ (text$ module)) (~ (text$ name))])))])
+ ([#Symbol])
+
+ _
+ (failure "Wrong syntax for symbol"))))])
+
+ ($.documentation /.and
+ "Short-circuiting 'and'."
+ [(and #1 #0)
+ "=>"
+ #0]
+ [(and #1 #1)
+ "=>"
+ #1])
+
+ ($.documentation /.or
+ "Short-circuiting 'or'."
+ [(or #1 #0)
+ "=>"
+ #1]
+ [(or #0 #0)
+ "=>"
+ #0])
+
+ ($.documentation /.panic!
+ "Causes an error, with the given error message."
+ [(panic! "OH NO!")])
+
+ ($.documentation /.implementation
+ "Express a value that implements an interface."
+ [(is (Order Int)
+ (implementation
+ (def equivalence
+ equivalence)
+ (def (< reference subject)
+ (< reference subject))
+ ))])
+
+ ($.documentation /.Variant
+ (format "Syntax for defining labelled/tagged sum/union types."
+ \n "WARNING: Only use it within the type macro.")
+ [(type Referrals
+ (Variant
+ {#All}
+ {#Only (List Text)}
+ {#Exclude (List Text)}
+ {#Ignore}
+ {#Nothing}))])
+
+ ($.documentation /.Record
+ (format "Syntax for defining labelled/slotted product/tuple types."
+ \n "WARNING: Only use it within the type macro.")
+ [(type Refer
+ (Record
+ [#refer_defs Referrals
+ #refer_open (List Openings)]))])
+
+ ($.documentation /.type
+ "The type-definition macro."
+ [(type (List a)
+ {#End}
+ {#Item a (List a)})])
+
+ ($.documentation /.Interface
+ "Interface definition."
+ [(type .public (Order a)
+ (Interface
+ (is (Equivalence a)
+ equivalence)
+ (is (-> a a Bit)
+ <)))])
+
+ (.~~ (.with_template [<name>]
+ [($.documentation <name>
+ "Safe type-casting for I64 values.")]
+
+ [/.i64]
+ [/.nat]
+ [/.int]
+ [/.rev]
+ ))
+
+ ($.documentation /.module_separator
+ (format "Character used to separate the parts of module names."
+ \n "Value: " (%.text /.module_separator)))
+
+ ($.documentation /.open
+ (format "Same as the 'open' macro, but meant to be used as a pattern-matching macro for generating local bindings."
+ \n "Takes an 'alias' text for the generated local bindings.")
+ [(def .public (range enum from to)
+ (All (_ a) (-> (Enum a) a a (List a)))
+ (let [(open "[0]") enum]
+ (loop (again [end to
+ output {.#End}])
+ (cond (< end from)
+ (again (pred end) {.#Item end output})
+
+ (< from end)
+ (again (succ end) {.#Item end output})
+
+ ... (= end from)
+ {.#Item end output}))))])
+
+ ($.documentation /.cond
+ "Conditional branching with multiple test conditions."
+ [(cond (even? num) "WHEN even"
+ (odd? num) "WHEN odd"
+ "ELSE")])
+
+ ($.documentation /.the
+ "Accesses the value of a record at a given tag."
+ [(the #field my_record)]
+ ["Can also work with multiple levels of nesting."
+ (the [#foo #bar #baz] my_record)]
+ ["And, if only the slot/path is given, generates an accessor function."
+ (let [getter (the [#foo #bar #baz])]
+ (getter my_record))])
+
+ ($.documentation /.use
+ "Opens a implementation and generates a definition for each of its members (including nested members)."
+ [(use "i:[0]" order)
+ "=>"
+ (def i:= (at order =))
+ (def i:< (at order <))])
+
+ ($.documentation /.|>>
+ "Similar to the piping macro, but rather than taking an initial object to work on, creates a function for taking it."
+ [(|>> (list#each int#encoded)
+ (interposed " ")
+ (mix text#composite ""))
+ "=>"
+ (function (_ <it>)
+ (mix text#composite ""
+ (interposed " "
+ (list#each int#encoded <it>))))])
+
+ ($.documentation /.<<|
+ "Similar to the reverse piping macro, but rather than taking an initial object to work on, creates a function for taking it."
+ [(<<| (mix text#composite "")
+ (interposed " ")
+ (list#each int#encoded))
+ "=>"
+ (function (_ <it>)
+ (mix text#composite ""
+ (interposed " "
+ (list#each int#encoded
+ <it>))))])
+
+ ($.documentation /.require
+ "Module-definition macro."
+ [(.require
+ [lux (.except)
+ [control
+ ["M" monad (.except)]]
+ [data
+ maybe
+ ["[0]" name (.use "[1]#[0]" codec)]]
+ [macro
+ code]]
+ [//
+ [type (.use "[0]" equivalence)]])])
+
+ ($.documentation /.at
+ "Allows accessing the value of a implementation's member."
+ [(at codec encoded)]
+ ["Also allows using that value as a function."
+ (at codec encoded +123)])
+
+ ($.documentation /.has
+ "Sets the value of a record at a given tag."
+ [(has #name "Lux" lang)]
+ ["Can also work with multiple levels of nesting."
+ (has [#foo #bar #baz] value my_record)]
+ ["And, if only the slot/path and (optionally) the value are given, generates a mutator function."
+ (let [setter (has [#foo #bar #baz] value)]
+ (setter my_record))
+ (let [setter (has [#foo #bar #baz])]
+ (setter value my_record))])
+
+ ($.documentation /.revised
+ "Modifies the value of a record at a given tag, based on some function."
+ [(revised #age ++ person)]
+ ["Can also work with multiple levels of nesting."
+ (revised [#foo #bar #baz] func my_record)]
+ ["And, if only the slot/path and (optionally) the value are given, generates a mutator function."
+ (let [updater (revised [#foo #bar #baz] func)]
+ (updater my_record))
+ (let [updater (revised [#foo #bar #baz])]
+ (updater func my_record))])
+
+ ... ($.documentation /.^template
+ ... "It's similar to template, but meant to be used during pattern-matching."
+ ... [(def (reduced env type)
+ ... (-> (List Type) Type Type)
+ ... (case type
+ ... {.#Primitive name params}
+ ... {.#Primitive name (list#each (reduced env) params)}
+
+ ... (^with_template [<tag>]
+ ... [{<tag> left right}
+ ... {<tag> (reduced env left) (reduced env right)}])
+ ... ([.#Sum] [.#Product])
+
+ ... (^with_template [<tag>]
+ ... [{<tag> left right}
+ ... {<tag> (reduced env left) (reduced env right)}])
+ ... ([.#Function] [.#Apply])
+
+ ... (^with_template [<tag>]
+ ... [{<tag> old_env def}
+ ... (case old_env
+ ... {.#End}
+ ... {<tag> env def}
+
+ ... _
+ ... type)])
+ ... ([.#UnivQ] [.#ExQ])
+
+ ... {.#Parameter idx}
+ ... (else type (list.item idx env))
+
+ ... _
+ ... type
+ ... ))])
+
+ (.~~ (.with_template [<name> <doc>]
+ [($.documentation <name>
+ <doc>)]
+
+ [/.++ "Increment function."]
+ [/.-- "Decrement function."]
+ ))
+
+ ($.documentation /.loop
+ (format "Allows arbitrary looping, using the 'again' form to re-start the loop."
+ \n "Can be used in monadic code to create monadic loops.")
+ [(loop (again [count +0
+ x init])
+ (if (< +10 count)
+ (again (++ count) (f x))
+ x))]
+ ["Loops can also be given custom names."
+ (loop (my_loop [count +0
+ x init])
+ (if (< +10 count)
+ (my_loop (++ count) (f x))
+ x))])
+
+ ($.documentation /.with_expansions
+ (format "Controlled macro-expansion."
+ \n "Bind an arbitraty number of Code nodes resulting from macro-expansion to local bindings."
+ \n "Wherever a binding appears, the bound Code nodes will be spliced in there.")
+ [(def test
+ Test
+ (with_expansions
+ [<tests> (with_template [<function> <parameter> <expected>]
+ [(cover [<function>]
+ (compare <text>
+ (at codec encoded <function> <parameter>)))]
+
+ [bit #1 "#1"]
+ [int +123 "+123"]
+ [frac +123.0 "+123.0"]
+ [text "123" "'123'"]
+ [symbol ["yolo" "lol"] "yolo.lol"]
+ [form (list (bit #1)) "(#1)"]
+ [tuple (list (bit #1)) "[#1]"]
+ )]
+ (all and
+ <tests>
+ )))])
+
+ ($.documentation /.static
+ (format "Resolves the names of definitions to their values at compile-time, assuming their values are either:"
+ \n "* Bit"
+ \n "* Nat"
+ \n "* Int"
+ \n "* Rev"
+ \n "* Frac"
+ \n "* Text")
+ [(def my_nat 123)
+ (def my_text "456")
+ (and (case [my_nat my_text]
+ (pattern (static [..my_nat ..my_text]))
+ true
+
+ _
+ false)
+ (case [my_nat my_text]
+ (pattern [(static ..my_nat) (static ..my_text)])
+ true
+
+ _
+ false))])
+
+ ... ($.documentation /.^multi
+ ... (format "Multi-level pattern matching."
+ ... \n "Useful in situations where the result of a branch depends on further refinements on the values being matched.")
+ ... [(case (split (size static) uri)
+ ... (^multi {#Some [chunk uri']}
+ ... [(text#= static chunk) #1])
+ ... (match_uri endpoint? parts' uri')
+
+ ... _
+ ... {#Left (format "Static part " (%t static) " does not match URI: " uri)})]
+ ... ["Short-cuts can be taken when using bit tests."
+ ... "The example above can be rewritten as..."
+ ... (case (split (size static) uri)
+ ... (^multi {#Some [chunk uri']}
+ ... (text#= static chunk))
+ ... (match_uri endpoint? parts' uri')
+
+ ... _
+ ... {#Left (format "Static part " (%t static) " does not match URI: " uri)})])
+
+ ($.documentation /.symbol
+ "Gives back a 2 tuple with the module and name parts, both as Text."
+ [(symbol ..#doc)
+ "=>"
+ ["documentation/lux" "#doc"]])
+
+ ($.documentation /.parameter
+ (format "WARNING: Please stay away from this macro; it's very likely to be removed in a future version of Lux."
+ "Allows you to refer to the type-variables in a polymorphic function's type, by their index.")
+ ["In the example below, 0 corresponds to the 'a' variable."
+ (def .public (of_list list)
+ (All (_ a) (-> (List a) (Sequence a)))
+ (list#mix add
+ (is (Sequence (parameter 0))
+ empty)
+ list))])
+
+ ($.documentation /.same?
+ "Tests whether the 2 values are identical (not just 'equal')."
+ ["This one should succeed:"
+ (let [value +5]
+ (same? value
+ value))]
+ ["This one should fail:"
+ (same? +5
+ (+ +2 +3))])
+
+ ... ($.documentation /.^let
+ ... "Allows you to simultaneously bind and de-structure a value."
+ ... [(def (hash (^let set [member_hash _]))
+ ... (list#mix (function (_ elem acc)
+ ... (+ acc
+ ... (at member_hash hash elem)))
+ ... 0
+ ... (set.list set)))])
+
+ ... ($.documentation /.^|>
+ ... "Pipes the value being pattern-matched against prior to binding it to a variable."
+ ... [(case input
+ ... (^|> value [++ (% 10) (max 1)])
+ ... (foo value))])
+
+ ($.documentation /.as_expected
+ "Coerces the given expression to the type of whatever is expected."
+ [(is Dinosaur
+ (as_expected (is (List Nat)
+ (list 1 2 3))))])
+
+ ($.documentation /.undefined
+ (format "Meant to be used as a stand-in for functions with undefined implementations."
+ \n "Undefined expressions will type-check against everything, so they make good dummy implementations."
+ \n "However, if an undefined expression is ever evaluated, it will raise a runtime error.")
+ [(def (square x)
+ (-> Int Int)
+ (undefined))])
+
+ ($.documentation /.type_of
+ "Generates the type corresponding to a given expression."
+ [(let [my_num +123]
+ (type_of my_num))
+ "=="
+ Int]
+ [(type_of +123)
+ "=="
+ Int])
+
+ ($.documentation /.template
+ (format "Define macros in the style of with_template."
+ \n "For simple macros that do not need any fancy features.")
+ [(def square
+ (template (square x)
+ (* x x)))])
+
+ ($.documentation /.these
+ (format "Given a (potentially empty) list of codes, just returns them immediately, without any work done."
+ \n "This may seen useless, but it has its utility when dealing with controlled-macro-expansion macros.")
+ [(with_expansions [<operands> (these 1
+ 2
+ 3
+ 4)]
+ (all + <operands>))])
+
+ ($.documentation /.char
+ "If given a 1-character text literal, yields the char-code of the sole character."
+ [(is Nat
+ (char "A"))
+ "=>"
+ 65])
+
+ ($.documentation /.for
+ (format "Selects the appropriate code for a given target-platform when compiling Lux to it."
+ \n "Look-up the available targets in library/lux/target.")
+ [(def js
+ "JavaScript")
+
+ (for "JVM" (do jvm stuff)
+ js (do js stuff)
+ (do default stuff))])
+
+ ($.documentation /.``
+ (format "Delimits a controlled (spliced) macro-expansion."
+ \n "Uses a (~~) special form to specify where to expand.")
+ [(`` (some expression
+ (~~ (some macro which may yield 0 or more results))))])
+
+ ... ($.documentation /.^code
+ ... "Generates pattern-matching code for Code values in a way that looks like code-templating."
+ ... [(is (Maybe Nat)
+ ... (case (` (#0 123 +456.789))
+ ... (^code (#0 (~ [_ {.#Nat number}]) +456.789))
+ ... {.#Some number}
+
+ ... _
+ ... {.#None}))])
+
+ ($.documentation /.false
+ "The boolean FALSE value.")
+
+ ($.documentation /.true
+ "The boolean TRUE value.")
+
+ ($.documentation /.try
+ ""
+ [(is Foo
+ (case (is (Either Text Bar)
+ (try (is Bar
+ (risky computation which may panic))))
+ {.#Right success}
+ (is Foo
+ (do something after success))
+
+ {.#Left error}
+ (is Foo
+ (recover from error))))])
+
+ ($.default (/.Code' w))
+ ($.default /.Alias)
+ ($.default (/.Bindings key value))
+ ($.default /.Ref)
+ ($.default /.Scope)
+ ($.default /.Source)
+ ($.default /.Module_State)
+ ($.default /.Type_Context)
+ ($.default /.Macro')
+ ($.default /.Label)
+ ($.default /.macro)]
+ [/abstract.documentation
+ /control.documentation
+ /data.documentation
+ /debug.documentation
+ /documentation.documentation
+ /extension.documentation
+ /ffi.documentation
+ /locale.documentation
+ /macro.documentation
+ /math.documentation
+ /meta.documentation
+ /program.documentation
+ /static.documentation
+ /target.documentation
+ /test.documentation
+ /time.documentation
+ /tool.documentation
+ /type.documentation
+ /world.documentation])))
(program: inputs
(io.io (debug.log! ($.markdown ..documentation))))
diff --git a/stdlib/source/documentation/lux/abstract.lux b/stdlib/source/documentation/lux/abstract.lux
index 809448aa0..52febba83 100644
--- a/stdlib/source/documentation/lux/abstract.lux
+++ b/stdlib/source/documentation/lux/abstract.lux
@@ -1,10 +1,8 @@
(.require
[library
[lux (.except)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
- [text (.only \n)
- ["%" \\format (.only format)]]
[collection
["[0]" list]]]]]
["[0]" /
diff --git a/stdlib/source/documentation/lux/abstract/apply.lux b/stdlib/source/documentation/lux/abstract/apply.lux
index 7acdd22f7..e14b743f1 100644
--- a/stdlib/source/documentation/lux/abstract/apply.lux
+++ b/stdlib/source/documentation/lux/abstract/apply.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux
- ["$" documentation (.only documentation)]]]
+ ["$" documentation]]]
[\\library
["[0]" /]])
@@ -9,9 +9,9 @@
(.List $.Module)
($.module /._
""
- [(documentation (/.Apply f)
+ [($.documentation (/.Apply f)
"Applicative functors.")
- (documentation /.composite
+ ($.documentation /.composite
"Applicative functor composition.")]
[]))
diff --git a/stdlib/source/documentation/lux/abstract/codec.lux b/stdlib/source/documentation/lux/abstract/codec.lux
index d90b32b19..0bf5a020c 100644
--- a/stdlib/source/documentation/lux/abstract/codec.lux
+++ b/stdlib/source/documentation/lux/abstract/codec.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux
- ["$" documentation (.only documentation)]]]
+ ["$" documentation]]]
[\\library
["[0]" /]])
@@ -9,10 +9,10 @@
(.List $.Module)
($.module /._
""
- [(documentation (/.Codec medium value)
+ [($.documentation (/.Codec medium value)
"A way to move back-and-forth between a type and an alternative representation for it.")
- (documentation /.composite
+ ($.documentation /.composite
"Codec composition."
[(is (Codec c a)
(composite (is (Codec c b)
diff --git a/stdlib/source/documentation/lux/abstract/comonad.lux b/stdlib/source/documentation/lux/abstract/comonad.lux
index d17c0aced..6649be330 100644
--- a/stdlib/source/documentation/lux/abstract/comonad.lux
+++ b/stdlib/source/documentation/lux/abstract/comonad.lux
@@ -1,27 +1,27 @@
(.require
[library
[lux
- ["$" documentation (.only documentation)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]]]
[\\library
["[0]" /]]
["[0]" /
- ["[1][0]" cofree]])
+ ["[1][0]" free]])
(.def .public documentation
(.List $.Module)
($.module /._
""
- [(documentation (/.CoMonad !)
+ [($.documentation (/.CoMonad !)
(format "Co-monads are the opposite/complement to monads."
\n "Co-monadic structures are often infinite in size and built upon lazily-evaluated functions."))
- (documentation /.be
+ ($.documentation /.be
"A co-monadic parallel to the 'do' macro."
[(let [square (function (_ n) (* n n))]
(be comonad
[inputs (iterate ++ +2)]
(square (out inputs))))])]
- [/cofree.documentation]))
+ [/free.documentation]))
diff --git a/stdlib/source/documentation/lux/abstract/comonad/cofree.lux b/stdlib/source/documentation/lux/abstract/comonad/cofree.lux
deleted file mode 100644
index b2c29f49f..000000000
--- a/stdlib/source/documentation/lux/abstract/comonad/cofree.lux
+++ /dev/null
@@ -1,16 +0,0 @@
-(.require
- [library
- [lux
- ["$" documentation (.only documentation)]]]
- [\\library
- ["[0]" /]])
-
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- ""
- [(documentation (/.CoFree ! it)
- "The CoFree CoMonad.")
- ($.default /.functor)
- ($.default /.comonad)]
- []))
diff --git a/stdlib/source/documentation/lux/abstract/comonad/free.lux b/stdlib/source/documentation/lux/abstract/comonad/free.lux
new file mode 100644
index 000000000..4d37b2953
--- /dev/null
+++ b/stdlib/source/documentation/lux/abstract/comonad/free.lux
@@ -0,0 +1,17 @@
+(.require
+ [library
+ [lux
+ ["$" documentation]]]
+ [\\library
+ ["[0]" /]])
+
+(.def .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [($.default /.functor)
+ ($.default /.comonad)
+
+ ($.documentation (/.Free ! it)
+ "The Free CoMonad.")]
+ []))
diff --git a/stdlib/source/documentation/lux/abstract/enum.lux b/stdlib/source/documentation/lux/abstract/enum.lux
index 4a2ba511b..b6c0aa0a1 100644
--- a/stdlib/source/documentation/lux/abstract/enum.lux
+++ b/stdlib/source/documentation/lux/abstract/enum.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux
- ["$" documentation (.only documentation)]]]
+ ["$" documentation]]]
[\\library
["[0]" /]])
@@ -9,10 +9,10 @@
(.List $.Module)
($.module /._
""
- [(documentation (/.Enum it)
+ [($.documentation (/.Enum it)
"Enumerable types, with a notion of moving forward and backwards through a type's instances.")
- (documentation /.range
+ ($.documentation /.range
"An inclusive [from, to] range of values."
[(range enum from to)])]
[]))
diff --git a/stdlib/source/documentation/lux/abstract/equivalence.lux b/stdlib/source/documentation/lux/abstract/equivalence.lux
index 66ffdf9af..0867832d8 100644
--- a/stdlib/source/documentation/lux/abstract/equivalence.lux
+++ b/stdlib/source/documentation/lux/abstract/equivalence.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux
- ["$" documentation (.only documentation)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]]]
@@ -12,10 +12,10 @@
(.List $.Module)
($.module /._
""
- [(documentation (/.Equivalence it)
+ [($.documentation (/.Equivalence it)
"Equivalence for a type's instances.")
- (documentation /.rec
+ ($.documentation /.rec
"A recursive equivalence combinator."
[(rec recursive_equivalence)])
diff --git a/stdlib/source/documentation/lux/abstract/functor.lux b/stdlib/source/documentation/lux/abstract/functor.lux
index b0521cae1..853b461f8 100644
--- a/stdlib/source/documentation/lux/abstract/functor.lux
+++ b/stdlib/source/documentation/lux/abstract/functor.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]]]
@@ -10,15 +10,6 @@
["[0]" /
["[1][0]" contravariant]])
-(documentation: /.sum
- "Co-product (sum) composition for functors.")
-
-(documentation: /.product
- "Product composition for functors.")
-
-(documentation: /.composite
- "Functor composition.")
-
(.def .public documentation
(.List $.Module)
($.module /._
@@ -27,7 +18,13 @@
($.default (/.Or left right))
($.default (/.And left right))
($.default (/.Then outer inner))
- ..sum
- ..product
- ..composite]
+
+ ($.documentation /.sum
+ "Co-product (sum) composition for functors.")
+
+ ($.documentation /.product
+ "Product composition for functors.")
+
+ ($.documentation /.composite
+ "Functor composition.")]
[/contravariant.documentation]))
diff --git a/stdlib/source/documentation/lux/abstract/functor/contravariant.lux b/stdlib/source/documentation/lux/abstract/functor/contravariant.lux
index 731af9b8e..406934d20 100644
--- a/stdlib/source/documentation/lux/abstract/functor/contravariant.lux
+++ b/stdlib/source/documentation/lux/abstract/functor/contravariant.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux
- ["$" documentation (.only documentation)]]]
+ ["$" documentation]]]
[\\library
["[0]" /]])
@@ -9,6 +9,6 @@
(.List $.Module)
($.module /._
""
- [(documentation (/.Functor !)
+ [($.documentation (/.Functor !)
"The contravariant functor.")]
[]))
diff --git a/stdlib/source/documentation/lux/abstract/hash.lux b/stdlib/source/documentation/lux/abstract/hash.lux
index 04323dcc6..da121864d 100644
--- a/stdlib/source/documentation/lux/abstract/hash.lux
+++ b/stdlib/source/documentation/lux/abstract/hash.lux
@@ -1,20 +1,19 @@
(.require
[library
[lux
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]]]
[\\library
["[0]" /]])
-(documentation: (/.Hash it)
- "A way to produce hash-codes for a type's instances.")
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..Hash
- ($.default /.functor)]
+ [($.default /.functor)
+
+ ($.documentation (/.Hash it)
+ "A way to produce hash-codes for a type's instances.")]
[]))
diff --git a/stdlib/source/documentation/lux/abstract/interval.lux b/stdlib/source/documentation/lux/abstract/interval.lux
index a97e137aa..84e20a61f 100644
--- a/stdlib/source/documentation/lux/abstract/interval.lux
+++ b/stdlib/source/documentation/lux/abstract/interval.lux
@@ -1,47 +1,18 @@
(.require
[library
[lux
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]]]
[\\library
["[0]" /]])
-(documentation: (/.Interval it)
- "A representation of top and bottom boundaries for an ordered type.")
-
-(documentation: /.singleton
- "An interval where both top and bottom are the same value."
- [(singleton enum elem)])
-
-(documentation: /.borders?
- "Where a value is at the border of an interval.")
-
-(documentation: /.union
- "An interval that spans both predecessors.")
-
-(documentation: /.intersection
- "An interval spanned by both predecessors.")
-
-(documentation: /.complement
- "The inverse of an interval.")
-
-(documentation: /.meets?
- "Whether an interval meets another one on its bottom/lower side.")
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..Interval
- ..singleton
- ..borders?
- ..union
- ..intersection
- ..complement
- ..meets?
- ($.default /.between)
+ [($.default /.between)
($.default /.inner?)
($.default /.outer?)
($.default /.singleton?)
@@ -57,5 +28,27 @@
($.default /.finishes?)
($.default /.equivalence)
($.default /.nested?)
- ($.default /.overlaps?)]
+ ($.default /.overlaps?)
+
+ ($.documentation (/.Interval it)
+ "A representation of top and bottom boundaries for an ordered type.")
+
+ ($.documentation /.singleton
+ "An interval where both top and bottom are the same value."
+ [(singleton enum elem)])
+
+ ($.documentation /.borders?
+ "Where a value is at the border of an interval.")
+
+ ($.documentation /.union
+ "An interval that spans both predecessors.")
+
+ ($.documentation /.intersection
+ "An interval spanned by both predecessors.")
+
+ ($.documentation /.complement
+ "The inverse of an interval.")
+
+ ($.documentation /.meets?
+ "Whether an interval meets another one on its bottom/lower side.")]
[]))
diff --git a/stdlib/source/documentation/lux/abstract/mix.lux b/stdlib/source/documentation/lux/abstract/mix.lux
index 744a5a2ba..d63ebe15a 100644
--- a/stdlib/source/documentation/lux/abstract/mix.lux
+++ b/stdlib/source/documentation/lux/abstract/mix.lux
@@ -1,24 +1,21 @@
(.require
[library
[lux
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]]]
[\\library
["[0]" /]])
-(documentation: (/.Mix structure)
- "Iterate over a structure's values to build a summary value.")
-
-(documentation: /.with_monoid
- "Mix a mixable structure using the monoid's identity as the initial value."
- [(with_monoid monoid mix value)])
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..Mix
- ..with_monoid]
+ [($.documentation (/.Mix structure)
+ "Iterate over a structure's values to build a summary value.")
+
+ ($.documentation /.with_monoid
+ "Mix a mixable structure using the monoid's identity as the initial value."
+ [(with_monoid monoid mix value)])]
[]))
diff --git a/stdlib/source/documentation/lux/abstract/monad.lux b/stdlib/source/documentation/lux/abstract/monad.lux
index cff2d9c20..3e160d0fe 100644
--- a/stdlib/source/documentation/lux/abstract/monad.lux
+++ b/stdlib/source/documentation/lux/abstract/monad.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]]]
@@ -10,46 +10,38 @@
["[0]" /
["[1][0]" free]])
-(documentation: (/.Monad it)
- (format "A monad is a monoid in the category of endofunctors."
- \n "What's the problem?"))
-
-(documentation: /.do
- "Macro for easy concatenation of monadic operations."
- [(do monad
- [y (f1 x)
- z (f2 z)]
- (in (f3 z)))])
-
-(documentation: /.then
- "Apply a function with monadic effects to a monadic value and yield a new monadic value."
- [(then monad function)])
-
-(documentation: /.all
- "Run all the monadic values in the list and produce a list of the base values."
- [(all monad)])
-
-(documentation: /.each
- "Apply a monadic function to all values in a list."
- [(each monad function items)])
-
-(documentation: /.only
- "Filter the values in a list with a monadic function."
- [(only monad predicate items)])
-
-(documentation: /.mix
- "Mix a list with a monadic function."
- [(mix monad function initial_value items)])
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..Monad
- ..do
- ..then
- ..all
- ..each
- ..only
- ..mix]
+ [($.documentation (/.Monad it)
+ (format "A monad is a monoid in the category of endofunctors."
+ \n "What's the problem?"))
+
+ ($.documentation /.do
+ "Macro for easy concatenation of monadic operations."
+ [(do monad
+ [y (f1 x)
+ z (f2 z)]
+ (in (f3 z)))])
+
+ ($.documentation /.then
+ "Apply a function with monadic effects to a monadic value and yield a new monadic value."
+ [(then monad function)])
+
+ ($.documentation /.all
+ "Run all the monadic values in the list and produce a list of the base values."
+ [(all monad)])
+
+ ($.documentation /.each
+ "Apply a monadic function to all values in a list."
+ [(each monad function items)])
+
+ ($.documentation /.only
+ "Filter the values in a list with a monadic function."
+ [(only monad predicate items)])
+
+ ($.documentation /.mix
+ "Mix a list with a monadic function."
+ [(mix monad function initial_value items)])]
[/free.documentation]))
diff --git a/stdlib/source/documentation/lux/abstract/monad/free.lux b/stdlib/source/documentation/lux/abstract/monad/free.lux
index ff1db175b..421a323c8 100644
--- a/stdlib/source/documentation/lux/abstract/monad/free.lux
+++ b/stdlib/source/documentation/lux/abstract/monad/free.lux
@@ -1,19 +1,18 @@
(.require
[library
[lux
- ["$" documentation (.only documentation:)]]]
+ ["$" documentation]]]
[\\library
["[0]" /]])
-(documentation: (/.Free ! it)
- "The Free Monad.")
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..Free
- ($.default /.functor)
+ [($.default /.functor)
($.default /.apply)
- ($.default /.monad)]
+ ($.default /.monad)
+
+ ($.documentation (/.Free ! it)
+ "The Free Monad.")]
[]))
diff --git a/stdlib/source/documentation/lux/abstract/monoid.lux b/stdlib/source/documentation/lux/abstract/monoid.lux
index 92a23f176..6b8dc5bbd 100644
--- a/stdlib/source/documentation/lux/abstract/monoid.lux
+++ b/stdlib/source/documentation/lux/abstract/monoid.lux
@@ -1,21 +1,20 @@
(.require
[library
[lux
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]]]
[\\library
["[0]" /]])
-(documentation: (/.Monoid it)
- (format "A way to compose values."
- \n "Includes an identity value which does not alter any other value when combined with."))
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..Monoid
- ($.default /.and)]
+ [($.default /.and)
+
+ ($.documentation (/.Monoid it)
+ (format "A way to compose values."
+ \n "Includes an identity value which does not alter any other value when combined with."))]
[]))
diff --git a/stdlib/source/documentation/lux/abstract/order.lux b/stdlib/source/documentation/lux/abstract/order.lux
index 53556553d..b28945800 100644
--- a/stdlib/source/documentation/lux/abstract/order.lux
+++ b/stdlib/source/documentation/lux/abstract/order.lux
@@ -1,48 +1,40 @@
(.require
[library
[lux
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]]]
[\\library
["[0]" /]])
-(documentation: (/.Order it)
- "A signature for types that possess some sense of ordering among their elements.")
+(.def .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [($.default /.functor)
-(documentation: (/.Comparison it)
- "An arbitrary comparison between two values, with the knowledge of how to order them.")
+ ($.documentation (/.Order it)
+ "A signature for types that possess some sense of ordering among their elements.")
-(documentation: /.<=
- "Less than or equal.")
+ ($.documentation (/.Comparison it)
+ "An arbitrary comparison between two values, with the knowledge of how to order them.")
-(documentation: /.>
- "Greater than.")
+ ($.documentation /.<=
+ "Less than or equal.")
-(documentation: /.>=
- "Greater than or equal.")
+ ($.documentation /.>
+ "Greater than.")
-(documentation: (/.Choice it)
- "A choice comparison between two values, with the knowledge of how to order them.")
+ ($.documentation /.>=
+ "Greater than or equal.")
-(documentation: /.min
- "Minimum.")
+ ($.documentation (/.Choice it)
+ "A choice comparison between two values, with the knowledge of how to order them.")
-(documentation: /.max
- "Maximum.")
+ ($.documentation /.min
+ "Minimum.")
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- ""
- [..Order
- ..Comparison
- ..<=
- ..>
- ..>=
- ..Choice
- ..min
- ..max
- ($.default /.functor)]
+ ($.documentation /.max
+ "Maximum.")]
[]))
diff --git a/stdlib/source/documentation/lux/abstract/predicate.lux b/stdlib/source/documentation/lux/abstract/predicate.lux
index 8c7ad5daa..e8507ce02 100644
--- a/stdlib/source/documentation/lux/abstract/predicate.lux
+++ b/stdlib/source/documentation/lux/abstract/predicate.lux
@@ -1,50 +1,42 @@
(.require
[library
[lux
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]]]
[\\library
["[0]" /]])
-(documentation: (/.Predicate it)
- "A question that can be asked of a value, yield either false (#0) or true (#1).")
+(.def .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [($.default /.union)
+ ($.default /.intersection)
+ ($.default /.functor)
-(documentation: /.none
- "A predicate that always fails.")
+ ($.documentation (/.Predicate it)
+ "A question that can be asked of a value, yield either false (#0) or true (#1).")
-(documentation: /.or
- "A predicate that meets either predecessor.")
+ ($.documentation /.none
+ "A predicate that always fails.")
-(documentation: /.all
- "A predicate that always succeeds.")
+ ($.documentation /.or
+ "A predicate that meets either predecessor.")
-(documentation: /.and
- "A predicate that meets both predecessors.")
+ ($.documentation /.all
+ "A predicate that always succeeds.")
-(documentation: /.complement
- "The opposite of a predicate.")
+ ($.documentation /.and
+ "A predicate that meets both predecessors.")
-(documentation: /.difference
- "A predicate that meeds 'base', but not 'sub'.")
+ ($.documentation /.complement
+ "The opposite of a predicate.")
-(documentation: /.rec
- "Ties the knot for a recursive predicate.")
+ ($.documentation /.difference
+ "A predicate that meeds 'base', but not 'sub'.")
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- ""
- [..Predicate
- ..none
- ..or
- ..all
- ..and
- ..complement
- ..difference
- ..rec
- ($.default /.union)
- ($.default /.intersection)
- ($.default /.functor)]
+ ($.documentation /.rec
+ "Ties the knot for a recursive predicate.")]
[]))
diff --git a/stdlib/source/documentation/lux/control/concatenative.lux b/stdlib/source/documentation/lux/control/concatenative.lux
index a09b7681c..2f553ce34 100644
--- a/stdlib/source/documentation/lux/control/concatenative.lux
+++ b/stdlib/source/documentation/lux/control/concatenative.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except if loop left right)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text
["%" \\format (.only format)]]]
@@ -16,253 +16,180 @@
[\\library
["[0]" /]])
-(documentation: /.=>
- "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))])
-
-(documentation: /.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> "."])]
- (documentation: <name>
- <doc>))]
-
- [1] [2] [3] [4]
- [5] [6] [7] [8]
- )
-
-(documentation: /.push
- "Push a value onto the stack.")
-
-(documentation: /.drop
- "Drop/pop a value from the top of the stack.")
-
-(documentation: /.nip
- "Drop the second-to-last value from the top of the stack.")
-
-(documentation: /.dup
- "Duplicate the top of the stack.")
-
-(documentation: /.swap
- "Swaps the 2 topmost stack values.")
-
-(documentation: /.left_rotation
- "Rotes the 3 topmost stack values to the left.")
-
-(documentation: /.right_rotation
- "Rotes the 3 topmost stack values to the right.")
-
-(documentation: /.&&
- "Groups the 2 topmost stack values as a 2-tuple.")
-
-(documentation: /.left
- "Left-injects the top into sum.")
-
-(documentation: /.right
- "Right-injects the top into sum.")
-
-(with_template [<input> <word> <func>]
- [(`` (documentation: (~~ (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.>=]
- )
-
-(documentation: /.if
- "If expression."
- [(same? "then"
- (/.value (|>> (push true)
- (push "then")
- (push "else")
- if)))])
-
-(documentation: /.call
- "Executes an anonymous block on the stack.")
-
-(documentation: /.loop
- "Executes a block as a loop until it yields #0 to stop.")
-
-(documentation: /.dip
- "Executes a block on the stack, save for the topmost value.")
-
-(documentation: /.dip_2
- "Executes a block on the stack, save for the 2 topmost values.")
-
-(documentation: /.do
- "Do-while loop expression."
- [(n.= (++ sample)
- (/.value (|>> (push sample)
- (push (push false))
- (push (|>> (push 1) n/+))
- do while)))])
-
-(documentation: /.while
- "While loop expression."
- [(n.= (n.+ distance start)
- (/.value (|>> (push start)
- (push (|>> dup
- (push start) n/-
- (push distance) n/<))
- (push (|>> (push 1) n/+))
- while)))])
-
-(documentation: /.compose
- "Function composition."
- [(n.= (n.+ 2 sample)
- (/.value (|>> (push sample)
- (push (|>> (push 1) n/+))
- (push (|>> (push 1) n/+))
- compose
- call)))])
-
-(documentation: /.partial
- "Partial application."
- [(n.= (n.+ sample sample)
- (/.value (|>> (push sample)
- (push sample)
- (push n/+)
- partial
- call)))])
-
-(documentation: /.when
- "Only execute the block when #1.")
-
-(documentation: /.?
- "Choose the top value when #0 and the second-to-top when #1.")
-
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- ""
- [..=>
- ..apply
- ..apply_1
- ..apply_2
- ..apply_3
- ..apply_4
- ..apply_5
- ..apply_6
- ..apply_7
- ..apply_8
- ..push
- ..drop
- ..nip
- ..dup
- ..swap
- ..left_rotation
- ..right_rotation
- ..&&
- ..left
- ..right
- ..if
- ..call
- ..loop
- ..dip
- ..dip_2
- ..do
- ..while
- ..compose
- ..partial
- ..when
- ..?
-
- ..n/+
- ..n/-
- ..n/*
- ..n//
- ..n/%
- ..n/=
- ..n/<
- ..n/<=
- ..n/>
- ..n/>=
- ..i/+
- ..i/-
- ..i/*
- ..i//
- ..i/%
- ..i/=
- ..i/<
- ..i/<=
- ..i/>
- ..i/>=
- ..r/+
- ..r/-
- ..r/*
- ..r//
- ..r/%
- ..r/=
- ..r/<
- ..r/<=
- ..r/>
- ..r/>=
- ..f/+
- ..f/-
- ..f/*
- ..f//
- ..f/%
- ..f/=
- ..f/<
- ..f/<=
- ..f/>
- ..f/>=
-
- ($.default /.value)]
- []))
+(`` (.def .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [($.default /.value)
+
+ ($.documentation /.=>
+ "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))])
+
+ ($.documentation /.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> "."])]
+ ($.documentation <name>
+ <doc>))]
+
+ [1] [2] [3] [4]
+ [5] [6] [7] [8]
+ ))
+
+ ($.documentation /.push
+ "Push a value onto the stack.")
+
+ ($.documentation /.drop
+ "Drop/pop a value from the top of the stack.")
+
+ ($.documentation /.nip
+ "Drop the second-to-last value from the top of the stack.")
+
+ ($.documentation /.dup
+ "Duplicate the top of the stack.")
+
+ ($.documentation /.swap
+ "Swaps the 2 topmost stack values.")
+
+ ($.documentation /.left_rotation
+ "Rotes the 3 topmost stack values to the left.")
+
+ ($.documentation /.right_rotation
+ "Rotes the 3 topmost stack values to the right.")
+
+ ($.documentation /.&&
+ "Groups the 2 topmost stack values as a 2-tuple.")
+
+ ($.documentation /.left
+ "Left-injects the top into sum.")
+
+ ($.documentation /.right
+ "Right-injects the top into sum.")
+
+ (~~ (with_template [<input> <word> <func>]
+ [(`` ($.documentation (~~ (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.>=]
+ ))
+
+ ($.documentation /.if
+ "If expression."
+ [(same? "then"
+ (/.value (|>> (push true)
+ (push "then")
+ (push "else")
+ if)))])
+
+ ($.documentation /.call
+ "Executes an anonymous block on the stack.")
+
+ ($.documentation /.loop
+ "Executes a block as a loop until it yields #0 to stop.")
+
+ ($.documentation /.dip
+ "Executes a block on the stack, save for the topmost value.")
+
+ ($.documentation /.dip_2
+ "Executes a block on the stack, save for the 2 topmost values.")
+
+ ($.documentation /.do
+ "Do-while loop expression."
+ [(n.= (++ sample)
+ (/.value (|>> (push sample)
+ (push (push false))
+ (push (|>> (push 1) n/+))
+ do while)))])
+
+ ($.documentation /.while
+ "While loop expression."
+ [(n.= (n.+ distance start)
+ (/.value (|>> (push start)
+ (push (|>> dup
+ (push start) n/-
+ (push distance) n/<))
+ (push (|>> (push 1) n/+))
+ while)))])
+
+ ($.documentation /.compose
+ "Function composition."
+ [(n.= (n.+ 2 sample)
+ (/.value (|>> (push sample)
+ (push (|>> (push 1) n/+))
+ (push (|>> (push 1) n/+))
+ compose
+ call)))])
+
+ ($.documentation /.partial
+ "Partial application."
+ [(n.= (n.+ sample sample)
+ (/.value (|>> (push sample)
+ (push sample)
+ (push n/+)
+ partial
+ call)))])
+
+ ($.documentation /.when
+ "Only execute the block when #1.")
+
+ ($.documentation /.?
+ "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 ffd314948..3a464a384 100644
--- a/stdlib/source/documentation/lux/control/concurrency.lux
+++ b/stdlib/source/documentation/lux/control/concurrency.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]
diff --git a/stdlib/source/documentation/lux/control/concurrency/actor.lux b/stdlib/source/documentation/lux/control/concurrency/actor.lux
index 27086e8b3..fd52ab040 100644
--- a/stdlib/source/documentation/lux/control/concurrency/actor.lux
+++ b/stdlib/source/documentation/lux/control/concurrency/actor.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except if loop)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,67 +10,54 @@
[\\library
["[0]" /]])
-(documentation: (/.Actor state)
- "An entity that can react to messages (mail) sent to it concurrently.")
+(.def .public documentation
+ (.List $.Module)
+ ($.module /._
+ "The actor model of concurrency."
+ [($.default /.poisoned)
+ ($.default /.dead)
+ ($.default /.alive?)
+ ($.default /.obituary')
-(documentation: (/.Mail state)
- "A one-way message sent to an actor, without expecting a reply.")
+ ($.documentation (/.Actor state)
+ "An entity that can react to messages (mail) sent to it concurrently.")
-(documentation: (/.Obituary state)
- "Details on the death of an actor.")
+ ($.documentation (/.Mail state)
+ "A one-way message sent to an actor, without expecting a reply.")
-(documentation: (/.Behavior state)
- "An actor's behavior when mail is received.")
+ ($.documentation (/.Obituary state)
+ "Details on the death of an actor.")
-(documentation: /.spawn!
- "Given a behavior and initial state, spawns an actor and returns it.")
+ ($.documentation (/.Behavior state)
+ "An actor's behavior when mail is received.")
-(documentation: /.obituary
- "Await for an actor to stop working.")
+ ($.documentation /.spawn!
+ "Given a behavior and initial state, spawns an actor and returns it.")
-(documentation: /.mail!
- "Send mail to an actor.")
+ ($.documentation /.obituary
+ "Await for an actor to stop working.")
-(documentation: (/.Message state output)
- "A two-way message sent to an actor, expecting a reply.")
+ ($.documentation /.mail!
+ "Send mail to an actor.")
-(documentation: /.tell!
- "Communicate with an actor through message-passing.")
+ ($.documentation (/.Message state output)
+ "A two-way message sent to an actor, expecting a reply.")
-(documentation: /.default
- "Default actor behavior.")
+ ($.documentation /.tell!
+ "Communicate with an actor through message-passing.")
-(documentation: /.poison!
- (format "Kills the actor by sending mail that will kill it upon processing,"
- \n "but allows the actor to handle previous mail."))
+ ($.documentation /.default
+ "Default actor behavior.")
-(documentation: /.Stop
- "A signal to stop an actor from observing a channel.")
+ ($.documentation /.poison!
+ (format "Kills the actor by sending mail that will kill it upon processing,"
+ \n "but allows the actor to handle previous mail."))
-(documentation: /.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."))
+ ($.documentation /.Stop
+ "A signal to stop an actor from observing a channel.")
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- "The actor model of concurrency."
- [..Actor
- ..Mail
- ..Obituary
- ..Behavior
- ..spawn!
- ..obituary
- ..mail!
- ..Message
- ..tell!
- ..default
- ..poison!
- ..Stop
- ..observe!
- ($.default /.poisoned)
- ($.default /.dead)
- ($.default /.alive?)
- ($.default /.obituary')]
+ ($.documentation /.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 37f5fd09e..6f43db6f6 100644
--- a/stdlib/source/documentation/lux/control/concurrency/async.lux
+++ b/stdlib/source/documentation/lux/control/concurrency/async.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except or and)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,87 +10,72 @@
[\\library
["[0]" /]])
-(documentation: (/.Async it)
- "Represents values produced by asynchronous computations (unlike IO, which is synchronous).")
+(.def .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [($.default /.functor)
+ ($.default /.apply)
+ ($.default /.monad)
-(documentation: (/.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."))
+ ($.documentation (/.Async it)
+ "Represents values produced by asynchronous computations (unlike IO, which is synchronous).")
-(documentation: /.resolved
- "Produces an async that has already been resolved to the given value."
- [(resolved value)])
+ ($.documentation (/.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."))
-(documentation: /.async
- "Creates a fresh async that has not been resolved yet."
- [(async _)])
+ ($.documentation /.resolved
+ "Produces an async that has already been resolved to the given value."
+ [(resolved value)])
-(documentation: /.value
- "Polls an async for its value.")
+ ($.documentation /.async
+ "Creates a fresh async that has not been resolved yet."
+ [(async _)])
-(documentation: /.upon!
- "Executes the given function as soon as the async has been resolved."
- [(upon! function async)])
+ ($.documentation /.value
+ "Polls an async for its value.")
-(documentation: /.resolved?
- "Checks whether an async's value has already been resolved.")
+ ($.documentation /.upon!
+ "Executes the given function as soon as the async has been resolved."
+ [(upon! function async)])
-(documentation: /.and
- "Combines the results of both asyncs, in-order."
- [(and left right)])
+ ($.documentation /.resolved?
+ "Checks whether an async's value has already been resolved.")
-(documentation: /.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)])
+ ($.documentation /.and
+ "Combines the results of both asyncs, in-order."
+ [(and left right)])
-(documentation: /.either
- (format "Yields the results of whichever async gets resolved first."
- \n "You cannot tell which one was resolved first.")
- [(either left right)])
+ ($.documentation /.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)])
-(documentation: /.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)])
+ ($.documentation /.either
+ (format "Yields the results of whichever async gets resolved first."
+ \n "You cannot tell which one was resolved first.")
+ [(either left right)])
-(documentation: /.future
- (format "Runs an I/O computation on its own thread."
- \n "Returns an async that will eventually host its result.")
- [(future computation)])
+ ($.documentation /.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)])
-(documentation: /.after
- "Delivers a value after a certain period has passed."
- [(after milli_seconds value)])
+ ($.documentation /.future
+ (format "Runs an I/O computation on its own thread."
+ \n "Returns an async that will eventually host its result.")
+ [(future computation)])
-(documentation: /.delay
- "An async that will be resolved after the specified amount of milli-seconds."
- [(delay milli_seconds)])
+ ($.documentation /.after
+ "Delivers a value after a certain period has passed."
+ [(after milli_seconds value)])
-(documentation: /.within
- "Wait for an async to be resolved within the specified amount of milli-seconds."
- [(within milli_seconds async)])
+ ($.documentation /.delay
+ "An async that will be resolved after the specified amount of milli-seconds."
+ [(delay milli_seconds)])
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- ""
- [..Async
- ..Resolver
- ..resolved
- ..async
- ..value
- ..upon!
- ..resolved?
- ..and
- ..or
- ..either
- ..schedule!
- ..future
- ..after
- ..delay
- ..within
- ($.default /.functor)
- ($.default /.apply)
- ($.default /.monad)]
+ ($.documentation /.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 054876501..5c39f27d5 100644
--- a/stdlib/source/documentation/lux/control/concurrency/atom.lux
+++ b/stdlib/source/documentation/lux/control/concurrency/atom.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except if loop)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,30 +10,26 @@
[\\library
["[0]" /]])
-(documentation: (/.Atom it)
- "Atomic references that are safe to mutate concurrently.")
-
-(documentation: /.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."))
-
-(documentation: /.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."))
-
-(documentation: /.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."))
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..Atom
- ..compare_and_swap!
- ..update!
- ..write!
- ($.default /.atom)
- ($.default /.read!)]
+ [($.default /.atom)
+ ($.default /.read!)
+
+ ($.documentation (/.Atom it)
+ "Atomic references that are safe to mutate concurrently.")
+
+ ($.documentation /.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."))
+
+ ($.documentation /.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."))
+
+ ($.documentation /.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 9c11eb6d2..ad35eba37 100644
--- a/stdlib/source/documentation/lux/control/concurrency/frp.lux
+++ b/stdlib/source/documentation/lux/control/concurrency/frp.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except if loop)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,49 +10,11 @@
[\\library
["[0]" /]])
-(documentation: (/.Channel it)
- "An asynchronous channel to distribute values.")
-
-(documentation: (/.Sink it)
- "The tail-end of a channel, which can be written-to to fee the channel.")
-
-(documentation: /.channel
- "Creates a brand-new channel and hands it over, along with the sink to write to it."
- [(channel _)])
-
-(documentation: (/.Subscriber it)
- "A function that can receive every value fed into a channel.")
-
-(documentation: /.only
- (format "Produces a new channel based on the old one, only with values"
- \n "that pass the test.")
- [(only pass? channel)])
-
-(documentation: /.of_async
- "A one-element channel containing the output from an async."
- [(of_async async)])
-
-(documentation: /.mix
- "Asynchronous mix over channels."
- [(mix f init channel)])
-
-(documentation: /.sequential
- "Transforms the given list into a channel with the same elements."
- [(sequential milli_seconds values)])
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..Channel
- ..Sink
- ..channel
- ..Subscriber
- ..only
- ..of_async
- ..mix
- ..sequential
- ($.default /.channel_is_already_closed)
+ [($.default /.channel_is_already_closed)
($.default /.functor)
($.default /.apply)
($.default /.monad)
@@ -62,5 +24,35 @@
($.default /.periodic)
($.default /.iterations)
($.default /.distinct)
- ($.default /.list)]
+ ($.default /.list)
+
+ ($.documentation (/.Channel it)
+ "An asynchronous channel to distribute values.")
+
+ ($.documentation (/.Sink it)
+ "The tail-end of a channel, which can be written-to to fee the channel.")
+
+ ($.documentation /.channel
+ "Creates a brand-new channel and hands it over, along with the sink to write to it."
+ [(channel _)])
+
+ ($.documentation (/.Subscriber it)
+ "A function that can receive every value fed into a channel.")
+
+ ($.documentation /.only
+ (format "Produces a new channel based on the old one, only with values"
+ \n "that pass the test.")
+ [(only pass? channel)])
+
+ ($.documentation /.of_async
+ "A one-element channel containing the output from an async."
+ [(of_async async)])
+
+ ($.documentation /.mix
+ "Asynchronous mix over channels."
+ [(mix f init channel)])
+
+ ($.documentation /.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 474144fff..91397cb83 100644
--- a/stdlib/source/documentation/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/documentation/lux/control/concurrency/semaphore.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except if loop)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,60 +10,49 @@
[\\library
["[0]" /]])
-(documentation: /.Semaphore
- "A tool for controlling access to resources by multiple concurrent processes.")
+(.def .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [($.default /.semaphore_is_maxed_out)
+ ($.default /.barrier)
-(documentation: /.semaphore
- ""
- [(semaphore initial_open_positions)])
+ ($.documentation /.Semaphore
+ "A tool for controlling access to resources by multiple concurrent processes.")
-(documentation: /.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)])
+ ($.documentation /.semaphore
+ ""
+ [(semaphore initial_open_positions)])
-(documentation: /.signal!
- "Signal to a semaphore that you're done with your work, and that there is a new open position."
- [(signal! semaphore)])
+ ($.documentation /.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)])
-(documentation: /.Mutex
- "A mutual-exclusion lock that can only be acquired by one process at a time.")
+ ($.documentation /.signal!
+ "Signal to a semaphore that you're done with your work, and that there is a new open position."
+ [(signal! semaphore)])
-(documentation: /.mutex
- "Creates a brand-new mutex."
- [(mutex _)])
+ ($.documentation /.Mutex
+ "A mutual-exclusion lock that can only be acquired by one process at a time.")
-(documentation: /.synchronize!
- "Runs the procedure with exclusive control of the mutex."
- [(synchronize! mutex procedure)])
+ ($.documentation /.mutex
+ "Creates a brand-new mutex."
+ [(mutex _)])
-(documentation: /.limit
- "Produce a limit for a barrier.")
+ ($.documentation /.synchronize!
+ "Runs the procedure with exclusive control of the mutex."
+ [(synchronize! mutex procedure)])
-(documentation: /.Limit
- "A limit for barriers.")
+ ($.documentation /.limit
+ "Produce a limit for a barrier.")
-(documentation: /.Barrier
- "A barrier that blocks all processes from proceeding until a given number of processes are parked at the barrier.")
+ ($.documentation /.Limit
+ "A limit for barriers.")
-(documentation: /.block!
- "Wait on a barrier until all processes have arrived and met the barrier's limit.")
+ ($.documentation /.Barrier
+ "A barrier that blocks all processes from proceeding until a given number of processes are parked at the barrier.")
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- ""
- [..Semaphore
- ..semaphore
- ..wait!
- ..signal!
- ..Mutex
- ..mutex
- ..synchronize!
- ..limit
- ..Limit
- ..Barrier
- ..block!
- ($.default /.semaphore_is_maxed_out)
- ($.default /.barrier)]
+ ($.documentation /.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 000afb6e0..d3e03d8fd 100644
--- a/stdlib/source/documentation/lux/control/concurrency/stm.lux
+++ b/stdlib/source/documentation/lux/control/concurrency/stm.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except if loop)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,43 +10,37 @@
[\\library
["[0]" /]])
-(documentation: (/.Var it)
- "A mutable cell containing a value, and observers that will be alerted of any change to it.")
-
-(documentation: /.var
- "Creates a new STM var, with a default value."
- [(var value)])
-
-(documentation: /.changes
- "Creates a channel that will receive all changes to the value of the given var."
- [(changes target)])
-
-(documentation: (/.STM it)
- "A computation which updates a transaction and produces a value.")
-
-(documentation: /.update
- "Update a var's value, and return a tuple with the old and the new values."
- [(update function var)])
-
-(documentation: /.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)])
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..Var
- ..var
- ..changes
- ..STM
- ..update
- ..commit!
- ($.default /.read)
+ [($.default /.read)
($.default /.write)
($.default /.functor)
($.default /.apply)
- ($.default /.monad)]
+ ($.default /.monad)
+
+ ($.documentation (/.Var it)
+ "A mutable cell containing a value, and observers that will be alerted of any change to it.")
+
+ ($.documentation /.var
+ "Creates a new STM var, with a default value."
+ [(var value)])
+
+ ($.documentation /.changes
+ "Creates a channel that will receive all changes to the value of the given var."
+ [(changes target)])
+
+ ($.documentation (/.STM it)
+ "A computation which updates a transaction and produces a value.")
+
+ ($.documentation /.update
+ "Update a var's value, and return a tuple with the old and the new values."
+ [(update function var)])
+
+ ($.documentation /.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 c4dbf2408..b0206bc6c 100644
--- a/stdlib/source/documentation/lux/control/concurrency/thread.lux
+++ b/stdlib/source/documentation/lux/control/concurrency/thread.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except if loop)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,17 +10,14 @@
[\\library
["[0]" /]])
-(documentation: /.parallelism
- "How many processes can run in parallel.")
-
-(documentation: /.schedule!
- "Executes an I/O procedure after some milli-seconds."
- [(schedule! milli_seconds action)])
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..parallelism
- ..schedule!]
+ [($.documentation /.parallelism
+ "How many processes can run in parallel.")
+
+ ($.documentation /.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 0c165a0d4..4cadaecc7 100644
--- a/stdlib/source/documentation/lux/control/continuation.lux
+++ b/stdlib/source/documentation/lux/control/continuation.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except if loop)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,44 +10,39 @@
[\\library
["[0]" /]])
-(documentation: (/.Cont input output)
- "Continuations.")
-
-(documentation: /.continued
- "Continues a continuation thunk."
- [(continued next cont)])
-
-(documentation: /.result
- "Forces a continuation thunk to be evaluated."
- [(result cont)])
-
-(documentation: /.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)))))])
-
-(documentation: /.pending
- "Turns any expression into a function that is pending a continuation."
- [(pending (some_function some_input))])
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..Cont
- ..continued
- ..result
- ..with_current
- ..pending
- ($.default /.reset)
+ [($.default /.reset)
($.default /.shift)
($.default /.functor)
($.default /.apply)
($.default /.monad)
- ($.default /.portal)]
+ ($.default /.portal)
+
+ ($.documentation (/.Cont input output)
+ "Continuations.")
+
+ ($.documentation /.continued
+ "Continues a continuation thunk."
+ [(continued next cont)])
+
+ ($.documentation /.result
+ "Forces a continuation thunk to be evaluated."
+ [(result cont)])
+
+ ($.documentation /.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)))))])
+
+ ($.documentation /.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 f0936e27e..b74a152fe 100644
--- a/stdlib/source/documentation/lux/control/exception.lux
+++ b/stdlib/source/documentation/lux/control/exception.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except if loop)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,70 +10,60 @@
[\\library
["[0]" /]])
-(documentation: (/.Exception it)
- "An exception provides a way to decorate error messages.")
+(.def .public documentation
+ (.List $.Module)
+ ($.module /._
+ "Pure-Lux exception-handling functionality."
+ [($.default /.assertion)
-(documentation: /.match?
- "Is this exception the cause of the error message?"
- [(match? exception error)])
+ ($.documentation (/.Exception it)
+ "An exception provides a way to decorate error messages.")
-(documentation: /.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)])
+ ($.documentation /.match?
+ "Is this exception the cause of the error message?"
+ [(match? exception error)])
-(documentation: /.otherwise
- "If no handler could be found to catch the exception, then run a function as a last-resort measure."
- [(otherwise else try)])
+ ($.documentation /.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)])
-(documentation: /.error
- "Constructs an error message from an exception."
- [(error exception message)])
+ ($.documentation /.otherwise
+ "If no handler could be found to catch the exception, then run a function as a last-resort measure."
+ [(otherwise else try)])
-(documentation: /.except
- "Decorate an error message with an Exception and lift it into the error-handling context."
- [(except exception message)])
+ ($.documentation /.error
+ "Constructs an error message from an exception."
+ [(error exception message)])
-(documentation: /.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)])
+ ($.documentation /.except
+ "Decorate an error message with an Exception and lift it into the error-handling context."
+ [(except exception message)])
-(documentation: /.report
- "An error report."
- [(is Text
- (report ["Row 0" value/0]
- ["Row 1" value/1]
- ,,,
- ["Row N" value/N]))])
+ ($.documentation /.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)])
-(documentation: /.listing
- (format "A numbered report of the entries on a list."
- \n "NOTE: 0-based numbering.")
- [(listing format entries)])
+ ($.documentation /.report
+ "An error report."
+ [(is Text
+ (report ["Row 0" value/0]
+ ["Row 1" value/1]
+ ,,,
+ ["Row N" value/N]))])
-(documentation: /.with
- "If a computation fails, prepends the exception to the error."
- [(with exception message computation)])
+ ($.documentation /.listing
+ (format "A numbered report of the entries on a list."
+ \n "NOTE: 0-based numbering.")
+ [(listing format entries)])
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- "Pure-Lux exception-handling functionality."
- [..Exception
- ..match?
- ..when
- ..otherwise
- ..error
- ..except
- ..exception
- ..report
- ..listing
- ..with
- ($.default /.assertion)]
+ ($.documentation /.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 4a0566eca..4d73ff69b 100644
--- a/stdlib/source/documentation/lux/control/function.lux
+++ b/stdlib/source/documentation/lux/control/function.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except if loop)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -15,41 +15,36 @@
["[1][0]" mixin]
["[1][0]" mutual]])
-(documentation: /.identity
- (format "Identity function."
- \n "Does nothing to its argument and just returns it.")
- [(same? (identity value)
- value)])
+(.def .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [($.default /.monoid)
-(documentation: /.composite
- "Function composition."
- [(= ((composite f g) "foo")
- (f (g "foo")))])
+ ($.documentation /.identity
+ (format "Identity function."
+ \n "Does nothing to its argument and just returns it.")
+ [(same? (identity value)
+ value)])
-(documentation: /.constant
- "Create constant functions."
- [(= ((constant "foo") "bar")
- "foo")])
+ ($.documentation /.composite
+ "Function composition."
+ [(= ((composite f g) "foo")
+ (f (g "foo")))])
-(documentation: /.flipped
- "Flips the order of the arguments of a function."
- [(= ((flipped f) "foo" "bar")
- (f "bar" "foo"))])
+ ($.documentation /.constant
+ "Create constant functions."
+ [(= ((constant "foo") "bar")
+ "foo")])
-(documentation: /.on
- "Simple 1-argument function application."
- [(on input function)])
+ ($.documentation /.flipped
+ "Flips the order of the arguments of a function."
+ [(= ((flipped f) "foo" "bar")
+ (f "bar" "foo"))])
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- ""
- [..identity
- ..composite
- ..constant
- ..flipped
- ..on
- ($.default /.monoid)]
+ ($.documentation /.on
+ "Simple 1-argument function application."
+ [(on input function)])]
[/contract.documentation
/memo.documentation
/mixin.documentation
diff --git a/stdlib/source/documentation/lux/control/function/contract.lux b/stdlib/source/documentation/lux/control/function/contract.lux
index 9545d94e2..d1a24154f 100644
--- a/stdlib/source/documentation/lux/control/function/contract.lux
+++ b/stdlib/source/documentation/lux/control/function/contract.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except if loop)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,27 +10,25 @@
[\\library
["[0]" /]])
-(documentation: /.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))])
-
-(documentation: /.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))])
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..pre
- ..post
- ($.default /.pre_condition_failed)
- ($.default /.post_condition_failed)]
+ [($.default /.pre_condition_failed)
+ ($.default /.post_condition_failed)
+
+ ($.documentation /.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))])
+
+ ($.documentation /.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 9699fccee..6b78db63e 100644
--- a/stdlib/source/documentation/lux/control/function/memo.lux
+++ b/stdlib/source/documentation/lux/control/function/memo.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except open)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,27 +10,24 @@
[\\library
["[0]" /]])
-(documentation: /.open
- "Memoization where the memoized results can be re-used accross invocations."
- [(open memo)])
-
-(documentation: /.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)])
-
-(documentation: /.none
- (format "No memoization at all."
- \n "This is useful as a test control when measuring the effect of using memoization.")
- [(none hash memo)])
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..open
- ..closed
- ..none
- ($.default /.memoization)
- ($.default (/.Memo input output))]
+ [($.default /.memoization)
+ ($.default (/.Memo input output))
+
+ ($.documentation /.open
+ "Memoization where the memoized results can be re-used accross invocations."
+ [(open memo)])
+
+ ($.documentation /.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)])
+
+ ($.documentation /.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 96bbb9756..7f05a4502 100644
--- a/stdlib/source/documentation/lux/control/function/mixin.lux
+++ b/stdlib/source/documentation/lux/control/function/mixin.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except if loop)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,51 +10,42 @@
[\\library
["[0]" /]])
-(documentation: (/.Mixin input output)
- "A partially-defined function which can be mixed with others to inherit their behavior.")
+(.def .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [($.default /.monoid)
-(documentation: /.fixed
- "Given a mixin, produces a normal function."
- [(fixed f)])
+ ($.documentation (/.Mixin input output)
+ "A partially-defined function which can be mixed with others to inherit their behavior.")
-(documentation: /.nothing
- "A mixin that does nothing and just delegates work to the next mixin.")
+ ($.documentation /.fixed
+ "Given a mixin, produces a normal function."
+ [(fixed f)])
-(documentation: /.mixed
- "Produces a new mixin, where the behavior of the child can make use of the behavior of the parent."
- [(mixed parent child)])
+ ($.documentation /.nothing
+ "A mixin that does nothing and just delegates work to the next mixin.")
-(documentation: /.advice
- "Only apply then mixin when the input meets some criterion."
- [(advice when then)])
+ ($.documentation /.mixed
+ "Produces a new mixin, where the behavior of the child can make use of the behavior of the parent."
+ [(mixed parent child)])
-(documentation: /.before
- "Executes an action before doing the main work."
- [(before monad action)])
+ ($.documentation /.advice
+ "Only apply then mixin when the input meets some criterion."
+ [(advice when then)])
-(documentation: /.after
- "Executes an action after doing the main work."
- [(after monad action)])
+ ($.documentation /.before
+ "Executes an action before doing the main work."
+ [(before monad action)])
-(documentation: (/.Recursive input output)
- "An indirectly recursive function.")
+ ($.documentation /.after
+ "Executes an action after doing the main work."
+ [(after monad action)])
-(documentation: /.of_recursive
- "Transform an indirectly recursive function into a mixin."
- [(of_recursive recursive)])
+ ($.documentation (/.Recursive input output)
+ "An indirectly recursive function.")
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- ""
- [..Mixin
- ..fixed
- ..nothing
- ..mixed
- ..advice
- ..before
- ..after
- ..Recursive
- ..of_recursive
- ($.default /.monoid)]
+ ($.documentation /.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 57cf0d2f3..96208e936 100644
--- a/stdlib/source/documentation/lux/control/function/mutual.lux
+++ b/stdlib/source/documentation/lux/control/function/mutual.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except let def)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,41 +10,38 @@
[\\library
["[0]" /]])
-(documentation: /.let
- "Locally-defined mutually-recursive functions."
- [(let [(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)))])
-
-(documentation: /.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)))])])
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..let
- ..def]
+ [($.documentation /.let
+ "Locally-defined mutually-recursive functions."
+ [(let [(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)))])
+
+ ($.documentation /.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/io.lux b/stdlib/source/documentation/lux/control/io.lux
index ff76f1396..495f57023 100644
--- a/stdlib/source/documentation/lux/control/io.lux
+++ b/stdlib/source/documentation/lux/control/io.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except if loop)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,27 +10,24 @@
[\\library
["[0]" /]])
-(documentation: (/.IO it)
- "A type that represents synchronous, effectful computations that may interact with the outside world.")
-
-(documentation: /.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..."))])
-
-(documentation: /.run!
- "A way to execute IO computations and perform their side-effects.")
-
(.def .public documentation
(.List $.Module)
($.module /._
"A method for abstracting I/O and effectful computations to make it safe while writing pure functional code."
- [..IO
- ..io
- ..run!
- ($.default /.functor)
+ [($.default /.functor)
($.default /.apply)
- ($.default /.monad)]
+ ($.default /.monad)
+
+ ($.documentation (/.IO it)
+ "A type that represents synchronous, effectful computations that may interact with the outside world.")
+
+ ($.documentation /.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..."))])
+
+ ($.documentation /.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 2476283ff..ddf543f5d 100644
--- a/stdlib/source/documentation/lux/control/lazy.lux
+++ b/stdlib/source/documentation/lux/control/lazy.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except if loop)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,23 +10,21 @@
[\\library
["[0]" /]])
-(documentation: (/.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."))
-
-(documentation: /.lazy
- "Specifies a lazy value by providing the expression that computes it."
- [(lazy eager_computation)])
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..Lazy
- ..lazy
- ($.default /.value)
+ [($.default /.value)
($.default /.equivalence)
($.default /.functor)
($.default /.apply)
- ($.default /.monad)]
+ ($.default /.monad)
+
+ ($.documentation (/.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."))
+
+ ($.documentation /.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 7b6176f48..0c0ff167e 100644
--- a/stdlib/source/documentation/lux/control/maybe.lux
+++ b/stdlib/source/documentation/lux/control/maybe.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except if loop)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,48 +10,44 @@
[\\library
["[0]" /]])
-(documentation: /.lifted
- "Wraps a monadic value with Maybe machinery."
- [(lifted monad)])
-
-(documentation: /.else
- (format "Allows you to provide a default value that will be used"
- \n "if a (Maybe x) value turns out to be .#None."
- \n "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])
-
-(documentation: /.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)])
-
-(documentation: /.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))])
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..lifted
- ..else
- ..trusted
- ..when
- ($.default /.monoid)
+ [($.default /.monoid)
($.default /.functor)
($.default /.apply)
($.default /.monad)
($.default /.equivalence)
($.default /.hash)
($.default /.with)
- ($.default /.list)]
+ ($.default /.list)
+
+ ($.documentation /.lifted
+ "Wraps a monadic value with Maybe machinery."
+ [(lifted monad)])
+
+ ($.documentation /.else
+ (format "Allows you to provide a default value that will be used"
+ \n "if a (Maybe x) value turns out to be .#None."
+ \n "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])
+
+ ($.documentation /.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)])
+
+ ($.documentation /.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 b20bb433f..426854632 100644
--- a/stdlib/source/documentation/lux/control/parser.lux
+++ b/stdlib/source/documentation/lux/control/parser.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except or and not)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -22,149 +22,122 @@
["[1][0]" type]
["[1][0]" xml]])
-(documentation: (/.Parser state it)
- "A generic parser.")
-
-(documentation: /.assertion
- "Fails with the given message if the test is #0."
- [(assertion message test)])
+(.def .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [($.default /.functor)
+ ($.default /.apply)
+ ($.default /.monad)
-(documentation: /.maybe
- "Optionality combinator."
- [(maybe parser)])
+ ($.documentation (/.Parser state it)
+ "A generic parser.")
-(documentation: /.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)])
+ ($.documentation /.assertion
+ "Fails with the given message if the test is #0."
+ [(assertion message test)])
-(documentation: /.and
- "Sequencing combinator."
- [(and first second)])
+ ($.documentation /.maybe
+ "Optionality combinator."
+ [(maybe parser)])
-(documentation: /.or
- "Heterogeneous alternative combinator."
- [(or left right)])
+ ($.documentation /.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)])
-(documentation: /.either
- "Homogeneous alternative combinator."
- [(either this that)])
+ ($.documentation /.and
+ "Sequencing combinator."
+ [(and first second)])
-(documentation: /.some
- "0-or-more combinator."
- [(some parser)])
+ ($.documentation /.or
+ "Heterogeneous alternative combinator."
+ [(or left right)])
-(documentation: /.many
- "1-or-more combinator."
- [(many parser)])
+ ($.documentation /.either
+ "Homogeneous alternative combinator."
+ [(either this that)])
-(documentation: /.exactly
- "Parse exactly N times."
- [(exactly amount parser)])
+ ($.documentation /.some
+ "0-or-more combinator."
+ [(some parser)])
-(documentation: /.at_least
- "Parse at least N times."
- [(at_least amount parser)])
+ ($.documentation /.many
+ "1-or-more combinator."
+ [(many parser)])
-(documentation: /.at_most
- "Parse at most N times."
- [(at_most amount parser)])
+ ($.documentation /.exactly
+ "Parse exactly N times."
+ [(exactly amount parser)])
-(documentation: /.between
- ""
- [(between minimum additional parser)])
+ ($.documentation /.at_least
+ "Parse at least N times."
+ [(at_least amount parser)])
-(documentation: /.separated_by
- "Parses instances of 'parser' that are separated by instances of 'separator'."
- [(separated_by separator parser)])
+ ($.documentation /.at_most
+ "Parse at most N times."
+ [(at_most amount parser)])
-(documentation: /.not
- "Only succeeds when the underlying parser fails."
- [(not parser)])
+ ($.documentation /.between
+ ""
+ [(between minimum additional parser)])
-(documentation: /.failure
- "Always fail with this 'message'."
- [(failure message)])
+ ($.documentation /.separated_by
+ "Parses instances of 'parser' that are separated by instances of 'separator'."
+ [(separated_by separator parser)])
-(documentation: /.lifted
- "Lift a potentially failed computation into a parser."
- [(lifted operation)])
+ ($.documentation /.not
+ "Only succeeds when the underlying parser fails."
+ [(not parser)])
-(documentation: /.else
- "If the given parser fails, returns the default value."
- [(else value parser)])
+ ($.documentation /.failure
+ "Always fail with this 'message'."
+ [(failure message)])
-(documentation: /.remaining
- "Yield the remaining input (without consuming it).")
+ ($.documentation /.lifted
+ "Lift a potentially failed computation into a parser."
+ [(lifted operation)])
-(documentation: /.rec
- "Combinator for recursive parsers."
- [(rec parser)])
+ ($.documentation /.else
+ "If the given parser fails, returns the default value."
+ [(else value parser)])
-(documentation: /.after
- "Run the parser after another one (whose output is ignored)."
- [(after param subject)])
+ ($.documentation /.remaining
+ "Yield the remaining input (without consuming it).")
-(documentation: /.before
- "Run the parser before another one (whose output is ignored)."
- [(before param subject)])
+ ($.documentation /.rec
+ "Combinator for recursive parsers."
+ [(rec parser)])
-(documentation: /.only
- "Only succeed when the parser's output passes a test."
- [(only test parser)])
+ ($.documentation /.after
+ "Run the parser after another one (whose output is ignored)."
+ [(after param subject)])
-(documentation: /.parses?
- "Ignore a parser's output and just verify that it succeeds."
- [(parses? parser)])
+ ($.documentation /.before
+ "Run the parser before another one (whose output is ignored)."
+ [(before param subject)])
-(documentation: /.parses
- "Ignore a parser's output and just execute it."
- [(parses parser)])
+ ($.documentation /.only
+ "Only succeed when the parser's output passes a test."
+ [(only test parser)])
-(documentation: /.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)])
+ ($.documentation /.parses?
+ "Ignore a parser's output and just verify that it succeeds."
+ [(parses? parser)])
-(documentation: /.codec
- "Decode the output of a parser using a codec."
- [(codec codec parser)])
+ ($.documentation /.parses
+ "Ignore a parser's output and just execute it."
+ [(parses parser)])
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- ""
- [..Parser
- ..assertion
- ..maybe
- ..result
- ..and
- ..or
- ..either
- ..some
- ..many
- ..exactly
- ..at_least
- ..at_most
- ..between
- ..separated_by
- ..not
- ..failure
- ..lifted
- ..else
- ..remaining
- ..rec
- ..after
- ..before
- ..only
- ..parses?
- ..parses
- ..speculative
- ..codec
- ($.default /.functor)
- ($.default /.apply)
- ($.default /.monad)]
+ ($.documentation /.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)])
+
+ ($.documentation /.codec
+ "Decode the output of a parser using a codec."
+ [(codec codec parser)])]
[/analysis.documentation
/binary.documentation
/cli.documentation
diff --git a/stdlib/source/documentation/lux/control/pipe.lux b/stdlib/source/documentation/lux/control/pipe.lux
index e3fd4900a..614e8f5c4 100644
--- a/stdlib/source/documentation/lux/control/pipe.lux
+++ b/stdlib/source/documentation/lux/control/pipe.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except let cond if exec case)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,109 +10,98 @@
[\\library
["[0]" /]])
-(documentation: /.new
- "Ignores the piped argument, and begins a new pipe."
- [(n.= 1
- (|> 20
- (n.* 3)
- (n.+ 4)
- (new 0 [++])))])
-
-(documentation: /.let
- "Gives a name to the piped-argument, within the given expression."
- [(n.= 10
- (|> 5
- (let x (n.+ x x))))])
+(.def .public documentation
+ (.List $.Module)
+ ($.module /._
+ "Composable extensions to the piping macros (|> and <|) that enhance them with various abilities."
+ [($.documentation /.new
+ "Ignores the piped argument, and begins a new pipe."
+ [(n.= 1
+ (|> 20
+ (n.* 3)
+ (n.+ 4)
+ (new 0 [++])))])
-(documentation: /.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 [])]))])
+ ($.documentation /.let
+ "Gives a name to the piped-argument, within the given expression."
+ [(n.= 10
+ (|> 5
+ (let x (n.+ x x))))])
-(documentation: /.if
- "If-branching."
- [(same? (if (n.even? sample)
- "even"
- "odd")
- (|> sample
- (if [n.even?]
- [(new "even" [])]
- [(new "odd" [])])))])
+ ($.documentation /.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 [])]))])
-(documentation: /.when
- "Only execute the body when the test passes."
- [(same? (if (n.even? sample)
- (n.* 2 sample)
- sample)
- (|> sample
- (when [n.even?]
- [(n.* 2)])))])
+ ($.documentation /.if
+ "If-branching."
+ [(same? (if (n.even? sample)
+ "even"
+ "odd")
+ (|> sample
+ (if [n.even?]
+ [(new "even" [])]
+ [(new "odd" [])])))])
-(documentation: /.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)]
- [++]))])
+ ($.documentation /.when
+ "Only execute the body when the test passes."
+ [(same? (if (n.even? sample)
+ (n.* 2 sample)
+ sample)
+ (|> sample
+ (when [n.even?]
+ [(n.* 2)])))])
-(documentation: /.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)]
- [++]))])
+ ($.documentation /.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)]
+ [++]))])
-(documentation: /.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))])
+ ($.documentation /.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)]
+ [++]))])
-(documentation: /.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"]])
+ ($.documentation /.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))])
-(documentation: /.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"
- _ "???"))])
+ ($.documentation /.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"]])
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- "Composable extensions to the piping macros (|> and <|) that enhance them with various abilities."
- [..new
- ..let
- ..cond
- ..if
- ..when
- ..while
- ..do
- ..exec
- ..tuple
- ..case]
+ ($.documentation /.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 6dec9ff36..c411c6f32 100644
--- a/stdlib/source/documentation/lux/control/reader.lux
+++ b/stdlib/source/documentation/lux/control/reader.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except local)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,38 +10,32 @@
[\\library
["[0]" /]])
-(documentation: (/.Reader environment it)
- "Computations that have access to some environmental value.")
+(.def .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [($.default /.functor)
+ ($.default /.apply)
+ ($.default /.monad)
-(documentation: /.read
- "Get the environment.")
+ ($.documentation (/.Reader environment it)
+ "Computations that have access to some environmental value.")
-(documentation: /.local
- "Run computation with a locally-modified environment."
- [(local change proc)])
+ ($.documentation /.read
+ "Get the environment.")
-(documentation: /.result
- "Executes the reader against the given environment."
- [(result env proc)])
+ ($.documentation /.local
+ "Run computation with a locally-modified environment."
+ [(local change proc)])
-(documentation: /.with
- "Monad transformer for Reader."
- [(with monad)])
+ ($.documentation /.result
+ "Executes the reader against the given environment."
+ [(result env proc)])
-(documentation: /.lifted
- "Lift monadic values to the Reader wrapper.")
+ ($.documentation /.with
+ "Monad transformer for Reader."
+ [(with monad)])
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- ""
- [..Reader
- ..read
- ..local
- ..result
- ..with
- ..lifted
- ($.default /.functor)
- ($.default /.apply)
- ($.default /.monad)]
+ ($.documentation /.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 dcfed365c..c0da27237 100644
--- a/stdlib/source/documentation/lux/control/region.lux
+++ b/stdlib/source/documentation/lux/control/region.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except if loop)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,42 +10,36 @@
[\\library
["[0]" /]])
-(documentation: (/.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."))
-
-(documentation: /.run!
- "Executes a region-based computation, with a side-effect determined by the monad."
- [(run! monad computation)])
-
-(documentation: /.acquire!
- "Acquire a resource while pairing it a function that knows how to reclaim it."
- [(acquire! monad cleaner value)])
-
-(documentation: /.failure
- "Immediately fail with this 'message'."
- [(failure monad error)])
-
-(documentation: /.except
- "Fail by throwing/raising an exception."
- [(except monad exception message)])
-
-(documentation: /.lifted
- "Lift an effectful computation into a region-based computation."
- [(lifted monad operation)])
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..Region
- ..run!
- ..acquire!
- ..failure
- ..except
- ..lifted
- ($.default /.clean_up_error)
+ [($.default /.clean_up_error)
($.default /.functor)
($.default /.apply)
- ($.default /.monad)]
+ ($.default /.monad)
+
+ ($.documentation (/.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."))
+
+ ($.documentation /.run!
+ "Executes a region-based computation, with a side-effect determined by the monad."
+ [(run! monad computation)])
+
+ ($.documentation /.acquire!
+ "Acquire a resource while pairing it a function that knows how to reclaim it."
+ [(acquire! monad cleaner value)])
+
+ ($.documentation /.failure
+ "Immediately fail with this 'message'."
+ [(failure monad error)])
+
+ ($.documentation /.except
+ "Fail by throwing/raising an exception."
+ [(except monad exception message)])
+
+ ($.documentation /.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 cdc476e46..3d40127a4 100644
--- a/stdlib/source/documentation/lux/control/remember.lux
+++ b/stdlib/source/documentation/lux/control/remember.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,39 +10,36 @@
[\\library
["[0]" /]])
-(documentation: /.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))))])
-
-(documentation: /.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))))])
-
-(documentation: /.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))))])
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..remember
- ..to_do
- ..fix_me
- ($.default /.must_remember)]
+ [($.default /.must_remember)
+
+ ($.documentation /.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))))])
+
+ ($.documentation /.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))))])
+
+ ($.documentation /.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 006fbfd0b..2c18b0150 100644
--- a/stdlib/source/documentation/lux/control/security.lux
+++ b/stdlib/source/documentation/lux/control/security.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]
diff --git a/stdlib/source/documentation/lux/control/state.lux b/stdlib/source/documentation/lux/control/state.lux
index a381f42f0..fa5a0ee5f 100644
--- a/stdlib/source/documentation/lux/control/state.lux
+++ b/stdlib/source/documentation/lux/control/state.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except local)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,73 +10,60 @@
[\\library
["[0]" /]])
-(documentation: (/.State state it)
- "Stateful computations.")
+(.def .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [($.default /.functor)
+ ($.default /.apply)
+ ($.default /.monad)
-(documentation: /.get
- "Read the current state.")
+ ($.documentation (/.State state it)
+ "Stateful computations.")
-(documentation: /.put
- "Set the new state."
- [(put new_state)])
+ ($.documentation /.get
+ "Read the current state.")
-(documentation: /.update
- "Compute the new state."
- [(update change)])
+ ($.documentation /.put
+ "Set the new state."
+ [(put new_state)])
-(documentation: /.use
- "Run a function on the current state."
- [(use user)])
+ ($.documentation /.update
+ "Compute the new state."
+ [(update change)])
-(documentation: /.local
- "Run the computation with a locally-modified state."
- [(local change action)])
+ ($.documentation /.use
+ "Run a function on the current state."
+ [(use user)])
-(documentation: /.result
- "Run a stateful computation."
- [(result state action)])
+ ($.documentation /.local
+ "Run the computation with a locally-modified state."
+ [(local change action)])
-(documentation: /.while
- "A stateful while loop."
- [(while condition body)])
+ ($.documentation /.result
+ "Run a stateful computation."
+ [(result state action)])
-(documentation: /.do_while
- "A stateful do-while loop."
- [(do_while condition body)])
+ ($.documentation /.while
+ "A stateful while loop."
+ [(while condition body)])
-(documentation: /.+State
- "Stateful computations decorated by a monad.")
+ ($.documentation /.do_while
+ "A stateful do-while loop."
+ [(do_while condition body)])
-(documentation: /.result'
- "Execute a stateful computation decorated by a monad."
- [(result' state action)])
+ ($.documentation /.+State
+ "Stateful computations decorated by a monad.")
-(documentation: /.with
- "A monad transformer to create composite stateful computations."
- [(with monad)])
+ ($.documentation /.result'
+ "Execute a stateful computation decorated by a monad."
+ [(result' state action)])
-(documentation: /.lifted
- "Lift monadic values to the +State wrapper."
- [(lifted monad ma)])
+ ($.documentation /.with
+ "A monad transformer to create composite stateful computations."
+ [(with monad)])
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- ""
- [..State
- ..get
- ..put
- ..update
- ..use
- ..local
- ..result
- ..while
- ..do_while
- ..+State
- ..result'
- ..with
- ..lifted
- ($.default /.functor)
- ($.default /.apply)
- ($.default /.monad)]
+ ($.documentation /.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 cbfdab03b..587c165a8 100644
--- a/stdlib/source/documentation/lux/control/thread.lux
+++ b/stdlib/source/documentation/lux/control/thread.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except local)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,48 +10,40 @@
[\\library
["[0]" /]])
-(documentation: (/.Thread ! it)
- "An imperative process with access to mutable values.")
+(.def .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [($.default /.functor)
+ ($.default /.apply)
+ ($.default /.monad)
-(documentation: (/.Box ! it)
- "A mutable box holding a value.")
+ ($.documentation (/.Thread ! it)
+ "An imperative process with access to mutable values.")
-(documentation: /.box
- "A brand-new box initialized to the given value."
- [(box init)])
+ ($.documentation (/.Box ! it)
+ "A mutable box holding a value.")
-(documentation: /.read!
- "Reads the current value in the box."
- [(read! box)])
+ ($.documentation /.box
+ "A brand-new box initialized to the given value."
+ [(box init)])
-(documentation: /.write!
- "Mutates the value in the box."
- [(write! value box)])
+ ($.documentation /.read!
+ "Reads the current value in the box."
+ [(read! box)])
-(documentation: /.result
- "Executes the imperative thread in a self-contained way."
- [(result thread)])
+ ($.documentation /.write!
+ "Mutates the value in the box."
+ [(write! value box)])
-(documentation: /.io
- "Transforms the imperative thread into an I/O computation.")
+ ($.documentation /.result
+ "Executes the imperative thread in a self-contained way."
+ [(result thread)])
-(documentation: /.update!
- "Update a box's value by applying a function to it."
- [(update! f box)])
+ ($.documentation /.io
+ "Transforms the imperative thread into an I/O computation.")
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- ""
- [..Thread
- ..Box
- ..box
- ..read!
- ..write!
- ..result
- ..io
- ..update!
- ($.default /.functor)
- ($.default /.apply)
- ($.default /.monad)]
+ ($.documentation /.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 31894e7d0..0283736a3 100644
--- a/stdlib/source/documentation/lux/control/try.lux
+++ b/stdlib/source/documentation/lux/control/try.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except local)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,53 +10,46 @@
[\\library
["[0]" /]])
-(documentation: (/.Try it)
- "A computation that can fail with an error message.")
-
-(documentation: /.with
- "Enhances a monad with error-handling functionality."
- [(with monad)])
-
-(documentation: /.lifted
- "Wraps a monadic value with error-handling machinery."
- [(lifted monad)])
-
-(documentation: /.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)])
-
-(documentation: /.maybe
- ""
- [(maybe try)])
-
-(documentation: /.of_maybe
- ""
- [(of_maybe maybe)])
-
-(documentation: /.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!"}))])
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..Try
- ..with
- ..lifted
- ..trusted
- ..maybe
- ..of_maybe
- ..else
- ($.default /.functor)
+ [($.default /.functor)
($.default /.apply)
($.default /.monad)
- ($.default /.equivalence)]
+ ($.default /.equivalence)
+
+ ($.documentation (/.Try it)
+ "A computation that can fail with an error message.")
+
+ ($.documentation /.with
+ "Enhances a monad with error-handling functionality."
+ [(with monad)])
+
+ ($.documentation /.lifted
+ "Wraps a monadic value with error-handling machinery."
+ [(lifted monad)])
+
+ ($.documentation /.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)])
+
+ ($.documentation /.maybe
+ ""
+ [(maybe try)])
+
+ ($.documentation /.of_maybe
+ ""
+ [(of_maybe maybe)])
+
+ ($.documentation /.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 e22842527..b824174ec 100644
--- a/stdlib/source/documentation/lux/control/writer.lux
+++ b/stdlib/source/documentation/lux/control/writer.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except local)
- ["$" documentation (.only documentation:)]
+ ["$" documentation]
[data
[text (.only \n)
["%" \\format (.only format)]]]
@@ -10,30 +10,26 @@
[\\library
["[0]" /]])
-(documentation: (/.Writer log value)
- "Represents a value with an associated 'log' to record arbitrary information.")
-
-(documentation: /.write
- "Write a value to the log."
- [(write message)])
-
-(documentation: /.with
- "Enhances a monad with Writer functionality."
- [(with monoid monad)])
-
-(documentation: /.lifted
- "Wraps a monadic value with Writer machinery."
- [(lifted monoid monad)])
-
(.def .public documentation
(.List $.Module)
($.module /._
""
- [..Writer
- ..write
- ..with
- ..lifted
- ($.default /.functor)
+ [($.default /.functor)
($.default /.apply)
- ($.default /.monad)]
+ ($.default /.monad)
+
+ ($.documentation (/.Writer log value)
+ "Represents a value with an associated 'log' to record arbitrary information.")
+
+ ($.documentation /.write
+ "Write a value to the log."
+ [(write message)])
+
+ ($.documentation /.with
+ "Enhances a monad with Writer functionality."
+ [(with monoid monad)])
+
+ ($.documentation /.lifted
+ "Wraps a monadic value with Writer machinery."
+ [(lifted monoid monad)])]
[]))
diff --git a/stdlib/source/documentation/lux/data/format/binary.lux b/stdlib/source/documentation/lux/data/format/binary.lux
index 64ece5b0b..b2ea53f63 100644
--- a/stdlib/source/documentation/lux/data/format/binary.lux
+++ b/stdlib/source/documentation/lux/data/format/binary.lux
@@ -22,12 +22,12 @@
(documentation: /.instance
"Given a specification of how to construct binary data, yields a binary blob that matches it.")
-(documentation: (/.Writer it)
+(documentation: (/.Format it)
"An operation that knows how to write information into a binary blob.")
(documentation: /.result
"Yields a binary blob with all the information written to it."
- [(result writer value)])
+ [(result format value)])
(documentation: /.or
""
@@ -38,7 +38,7 @@
[(and pre post)])
(documentation: /.rec
- "A combinator for recursive writers."
+ "A combinator for recursive formats."
[(rec body)])
(documentation: /.segment
@@ -53,7 +53,7 @@
..Specification
..no_op
..instance
- ..Writer
+ ..Format
..result
..or
..and
diff --git a/stdlib/source/documentation/lux/data/format/tar.lux b/stdlib/source/documentation/lux/data/format/tar.lux
index 5f58a2215..8da6c890f 100644
--- a/stdlib/source/documentation/lux/data/format/tar.lux
+++ b/stdlib/source/documentation/lux/data/format/tar.lux
@@ -81,7 +81,7 @@
($.default /.Contiguous)
($.default /.Entry)
($.default /.Tar)
- ($.default /.writer)
+ ($.default /.format)
($.default /.wrong_checksum)
($.default /.invalid_end_of_archive)
($.default /.parser)]
diff --git a/stdlib/source/format/lux/data/binary.lux b/stdlib/source/format/lux/data/binary.lux
index 23b1e9c39..8d31c23cc 100644
--- a/stdlib/source/format/lux/data/binary.lux
+++ b/stdlib/source/format/lux/data/binary.lux
@@ -70,16 +70,16 @@
[(n#+ sizeL sizeR)
(|>> mutL mutR)])))
-(.type .public (Writer a)
+(.type .public (Format a)
(-> a Specification))
-(def .public (result writer value)
- (All (_ a) (-> (Writer a) a Binary))
- (..instance (writer value)))
+(def .public (result format value)
+ (All (_ a) (-> (Format a) a Binary))
+ (..instance (format value)))
(with_template [<name> <size> <write>]
[(def .public <name>
- (Writer (I64 Any))
+ (Format (I64 Any))
(function (_ value)
[<size>
(function (_ [offset binary])
@@ -93,12 +93,12 @@
)
(def .public (or left right)
- (All (_ l r) (-> (Writer l) (Writer r) (Writer (Or l r))))
+ (All (_ l r) (-> (Format l) (Format r) (Format (Or l r))))
(function (_ altV)
(case altV
- (^.with_template [<number> <tag> <writer>]
+ (^.with_template [<number> <tag> <format>]
[{<tag> caseV}
- (let [[caseS caseT] (<writer> caseV)]
+ (let [[caseS caseT] (<format> caseV)]
[(.++ caseS)
(function (_ [offset binary])
(|> binary
@@ -110,25 +110,25 @@
)))
(def .public (and pre post)
- (All (_ a b) (-> (Writer a) (Writer b) (Writer [a b])))
+ (All (_ a b) (-> (Format a) (Format b) (Format [a b])))
(function (_ [preV postV])
(at ..monoid composite (pre preV) (post postV))))
(def .public (rec body)
- (All (_ a) (-> (-> (Writer a) (Writer a)) (Writer a)))
+ (All (_ a) (-> (-> (Format a) (Format a)) (Format a)))
(function (again value)
(body again value)))
(def .public any
- (Writer Any)
+ (Format Any)
(function.constant ..no_op))
(def .public bit
- (Writer Bit)
+ (Format Bit)
(|>> (pipe.case #0 0 #1 1) ..bits_8))
(with_template [<name> <type>]
- [(def .public <name> (Writer <type>) ..bits_64)]
+ [(def .public <name> (Format <type>) ..bits_64)]
[nat Nat]
[int Int]
@@ -136,11 +136,11 @@
)
(def .public frac
- (Writer Frac)
+ (Format Frac)
(|>> frac.bits ..bits_64))
(def .public (segment size)
- (-> Nat (Writer Binary))
+ (-> Nat (Format Binary))
(function (_ value)
[size
(function (_ [offset binary])
@@ -153,7 +153,7 @@
(with_template [<name> <bits> <size> <write>]
[(def .public <name>
- (Writer Binary)
+ (Format Binary)
(let [mask (..mask <size>)]
(function (_ value)
(let [size (|> value \\unsafe.size (i64.and mask))
@@ -173,7 +173,7 @@
(with_template [<name> <binary>]
[(def .public <name>
- (Writer Text)
+ (Format Text)
(|>> (at utf8.codec encoded) <binary>))]
[utf8_8 ..binary_8]
@@ -186,7 +186,7 @@
(with_template [<name> <size> <write>]
[(def .public (<name> valueW)
- (All (_ v) (-> (Writer v) (Writer (Sequence v))))
+ (All (_ v) (-> (Format v) (Format (Sequence v))))
(function (_ value)
(let [original_count (sequence.size value)
capped_count (i64.and (..mask <size>)
@@ -215,25 +215,25 @@
)
(def .public maybe
- (All (_ a) (-> (Writer a) (Writer (Maybe a))))
+ (All (_ a) (-> (Format a) (Format (Maybe a))))
(..or ..any))
(def .public (list value)
- (All (_ a) (-> (Writer a) (Writer (List a))))
+ (All (_ a) (-> (Format a) (Format (List a))))
(..rec
(|>> (..and value)
(..or ..any))))
(def .public (set value)
- (All (_ a) (-> (Writer a) (Writer (Set a))))
+ (All (_ a) (-> (Format a) (Format (Set a))))
(|>> set.list (..list value)))
(def .public symbol
- (Writer Symbol)
+ (Format Symbol)
(..and ..text ..text))
(def .public type
- (Writer Type)
+ (Format Type)
(..rec
(function (_ again)
(let [pair (..and again again)
@@ -241,9 +241,9 @@
quantified (..and (..list again) again)]
(function (_ altV)
(case altV
- (^.with_template [<number> <tag> <writer>]
+ (^.with_template [<number> <tag> <format>]
[{<tag> caseV}
- (let [[caseS caseT] (<writer> caseV)]
+ (let [[caseS caseT] (<format> caseV)]
[(.++ caseS)
(function (_ [offset binary])
(|> binary
@@ -264,20 +264,20 @@
))))))
(def .public location
- (Writer Location)
+ (Format Location)
(all ..and ..text ..nat ..nat))
(def .public code
- (Writer Code)
+ (Format Code)
(..rec
(function (_ again)
(let [sequence (..list again)]
(..and ..location
(function (_ altV)
(case altV
- (^.with_template [<number> <tag> <writer>]
+ (^.with_template [<number> <tag> <format>]
[{<tag> caseV}
- (let [[caseS caseT] (<writer> caseV)]
+ (let [[caseS caseT] (<format> caseV)]
[(.++ caseS)
(function (_ [offset binary])
(|> binary
diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux
index f40e0c4ab..07c493b97 100644
--- a/stdlib/source/library/lux/data/format/tar.lux
+++ b/stdlib/source/library/lux/data/format/tar.lux
@@ -13,10 +13,10 @@
["[0]" product]
["[0]" binary (.only Binary)
["[1]!" \\unsafe]
- ["[0]" \\format (.only Writer) (.use "[1]#[0]" monoid)]
+ ["[0]" \\format (.only Format) (.use "[1]#[0]" monoid)]
["<[1]>" \\parser (.only Parser)]]
["[0]" text (.only Char)
- ["%" \\format (.only format)]
+ ["%" \\format]
[encoding
["[0]" utf8]]]
[collection
@@ -52,7 +52,7 @@
padding (|> "0"
(list.repeated padding_size)
text.together)]
- (format padding number)))
+ (%.format padding number)))
(def blank " ")
(def null text.null)
@@ -61,7 +61,7 @@
(def big_size Size 11)
(with_template [<exception> <limit> <size>
- <type> <in> <out> <writer> <suffix>
+ <type> <in> <out> <format> <suffix>
<coercion>]
[(def .public <limit>
Nat
@@ -88,8 +88,8 @@
(-> <type> Nat)
(|>> representation))
- (def <writer>
- (Writer <type>)
+ (def <format>
+ (Format <type>)
(let [suffix <suffix>
padded_size (n.+ (text.size suffix) <size>)]
(|>> representation
@@ -107,11 +107,11 @@
[not_a_small_number small_limit ..small_size
Small small from_small
- small_writer (format ..blank ..null)
+ small_format (%.format ..blank ..null)
as_small]
[not_a_big_number big_limit ..big_size
Big big from_big
- big_writer ..blank
+ big_format ..blank
as_big]
)
@@ -172,7 +172,7 @@
(abstraction " "))
(def checksum_suffix
- (format ..blank ..null))
+ (%.format ..blank ..null))
(def checksum
(-> Binary Nat)
@@ -194,8 +194,8 @@
(text.suffix ..checksum_suffix)
abstraction))
- (def checksum_writer
- (Writer Checksum)
+ (def checksum_format
+ (Format Checksum)
(let [padded_size (n.+ (text.size ..checksum_suffix)
..small_size)]
(|>> representation
@@ -211,7 +211,7 @@
value (<>.lifted
(at n.octal decoded digits))]
(in [value
- (abstraction (format digits ..checksum_suffix))])))
+ (abstraction (%.format digits ..checksum_suffix))])))
)
(def last_ascii
@@ -248,7 +248,7 @@
_
(binary!.slice 0 (++ end) string))))))))
-(with_template [<type> <representation> <size> <exception> <in> <out> <writer> <parser> <none>]
+(with_template [<type> <representation> <size> <exception> <in> <out> <format> <parser> <none>]
[(primitive .public <type>
<representation>
@@ -273,8 +273,8 @@
(-> <type> <representation>)
(|>> representation))
- (def <writer>
- (Writer <type>)
+ (def <format>
+ (Format <type>)
(let [suffix ..null
padded_size (n.+ (text.size suffix) <size>)]
(|>> representation
@@ -300,8 +300,8 @@
(try.trusted (<in> "")))
)]
- [Name Text ..name_size name_is_too_long name from_name name_writer name_parser anonymous]
- [Path file.Path ..path_size path_is_too_long path from_path path_writer path_parser no_path]
+ [Name Text ..name_size name_is_too_long name from_name name_format name_parser anonymous]
+ [Path file.Path ..path_size path_is_too_long path from_path path_format path_parser no_path]
)
(def magic_size Size 7)
@@ -316,8 +316,8 @@
(-> Magic Text)
(|>> representation))
- (def magic_writer
- (Writer Magic)
+ (def magic_format
+ (Format Magic)
(let [padded_size (n.+ (text.size ..null)
..magic_size)]
(|>> representation
@@ -400,8 +400,8 @@
(-> Link_Flag Char)
(|>> representation))
- (def link_flag_writer
- (Writer Link_Flag)
+ (def link_flag_format
+ (Format Link_Flag)
(|>> representation
\\format.bits_8))
@@ -454,12 +454,12 @@
(i64.or (representation left)
(representation right))))
- (def mode_writer
- (Writer Mode)
+ (def mode_format
+ (Format Mode)
(|>> representation
..small
try.trusted
- ..small_writer))
+ ..small_format))
(exception .public (invalid_mode [value Nat])
(exception.report
@@ -619,34 +619,34 @@
#major_device Device
#minor_device Device]))
-(def header_writer'
- (Writer Header)
+(def header_format'
+ (Format Header)
(all \\format.and
- ..path_writer
- ..mode_writer
- ..small_writer
- ..small_writer
- ..big_writer
- ..big_writer
- ..checksum_writer
- ..link_flag_writer
- ..path_writer
- ..magic_writer
- ..name_writer
- ..name_writer
- ..small_writer
- ..small_writer
+ ..path_format
+ ..mode_format
+ ..small_format
+ ..small_format
+ ..big_format
+ ..big_format
+ ..checksum_format
+ ..link_flag_format
+ ..path_format
+ ..magic_format
+ ..name_format
+ ..name_format
+ ..small_format
+ ..small_format
))
-(def (header_writer header)
- (Writer Header)
+(def (header_format header)
+ (Format Header)
(let [checksum (|> header
(has #checksum ..dummy_checksum)
- (\\format.result ..header_writer')
+ (\\format.result ..header_format')
..checksum_code)]
(|> header
(has #checksum checksum)
- (\\format.result ..header_writer')
+ (\\format.result ..header_format')
(\\format.segment ..block_size))))
(def modification_time
@@ -656,14 +656,14 @@
.nat
..as_big))
-(def (file_writer link_flag)
- (-> Link_Flag (Writer File))
+(def (file_format link_flag)
+ (-> Link_Flag (Format File))
(function (_ [path modification_time mode ownership content])
(let [[size content] (..from_content content)
- writer (all \\format.and
- ..header_writer
+ format (all \\format.and
+ ..header_format
(\\format.segment (..rounded_content_size size)))]
- (writer [[#path path
+ (format [[#path path
#mode mode
#user_id (the [#user #id] ownership)
#group_id (the [#group #id] ownership)
@@ -679,17 +679,17 @@
#minor_device ..no_device]
content]))))
-(def normal_file_writer
- (Writer File)
- (..file_writer ..normal))
+(def normal_file_format
+ (Format File)
+ (..file_format ..normal))
-(def contiguous_file_writer
- (Writer File)
- (..file_writer ..contiguous))
+(def contiguous_file_format
+ (Format File)
+ (..file_format ..contiguous))
-(def (symbolic_link_writer path)
- (Writer Path)
- (..header_writer
+(def (symbolic_link_format path)
+ (Format Path)
+ (..header_format
[#path ..no_path
#mode ..none
#user_id ..no_id
@@ -705,9 +705,9 @@
#major_device ..no_device
#minor_device ..no_device]))
-(def (directory_writer path)
- (Writer Path)
- (..header_writer
+(def (directory_format path)
+ (Format Path)
+ (..header_format
[#path path
#mode ..none
#user_id ..no_id
@@ -723,24 +723,24 @@
#major_device ..no_device
#minor_device ..no_device]))
-(def entry_writer
- (Writer Entry)
+(def entry_format
+ (Format Entry)
(|>> (pipe.case
- {#Normal value} (..normal_file_writer value)
- {#Symbolic_Link value} (..symbolic_link_writer value)
- {#Directory value} (..directory_writer value)
- {#Contiguous value} (..contiguous_file_writer value))))
+ {#Normal value} (..normal_file_format value)
+ {#Symbolic_Link value} (..symbolic_link_format value)
+ {#Directory value} (..directory_format value)
+ {#Contiguous value} (..contiguous_file_format value))))
(def end_of_archive_size
Size
(n.* 2 ..block_size))
-(def .public writer
- (Writer Tar)
+(def .public format
+ (Format Tar)
(let [end_of_archive (binary!.empty ..end_of_archive_size)]
(function (_ tar)
(\\format#composite (sequence#mix (function (_ next total)
- (\\format#composite total (..entry_writer next)))
+ (\\format#composite total (..entry_format next)))
\\format#identity
tar)
(\\format.segment ..end_of_archive_size end_of_archive)))))
diff --git a/stdlib/source/library/lux/target/jvm/attribute.lux b/stdlib/source/library/lux/target/jvm/attribute.lux
index 3ecaa7321..3167f2516 100644
--- a/stdlib/source/library/lux/target/jvm/attribute.lux
+++ b/stdlib/source/library/lux/target/jvm/attribute.lux
@@ -10,7 +10,7 @@
["[0]" sum]
["[0]" product]
["[0]" binary
- ["[1]F" \\format (.only Writer)]]]
+ ["[1]F" \\format (.only Format)]]]
[macro
["^" pattern]]
[math
@@ -43,14 +43,14 @@
//unsigned.equivalence
Equivalence<about>))
-(def (info_writer writer)
+(def (info_format format)
(All (_ about)
- (-> (Writer about)
- (Writer (Info about))))
+ (-> (Format about)
+ (Format (Info about))))
(function (_ [name length info])
- (let [[nameS nameT] (//index.writer name)
- [lengthS lengthT] (//unsigned.writer/4 length)
- [infoS infoT] (writer info)]
+ (let [[nameS nameT] (//index.format name)
+ [lengthS lengthT] (//unsigned.format/4 length)
+ [infoS infoT] (format info)]
[(all n.+ nameS lengthS infoS)
(|>> nameT lengthT infoT)])))
@@ -136,14 +136,14 @@
[it (|> it //signature.signature //pool.utf8)]
(at ! each (signature' it) (//pool.utf8 "Signature"))))
-(def .public (writer it)
- (Writer Attribute)
+(def .public (format it)
+ (Format Attribute)
(case it
{#Constant it}
- ((info_writer /constant.writer) it)
+ ((info_format /constant.format) it)
{#Code it}
- ((info_writer (/code.writer writer)) it)
+ ((info_format (/code.format format)) it)
{#Signature it}
- ((info_writer //index.writer) it)))
+ ((info_format //index.format) it)))
diff --git a/stdlib/source/library/lux/target/jvm/attribute/code.lux b/stdlib/source/library/lux/target/jvm/attribute/code.lux
index face35c64..a350fde0f 100644
--- a/stdlib/source/library/lux/target/jvm/attribute/code.lux
+++ b/stdlib/source/library/lux/target/jvm/attribute/code.lux
@@ -7,7 +7,7 @@
["[0]" product]
["[0]" binary (.only Binary)]
["[0]" binary
- ["[1]F" \\format (.only Writer) (.use "[1]#[0]" monoid)]]
+ ["[1]F" \\format (.only Format) (.use "[1]#[0]" monoid)]]
[collection
["[0]" sequence (.only Sequence) (.use "[1]#[0]" functor mix)]]]
[math
@@ -65,19 +65,19 @@
))
... https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3
-(def .public (writer writer code)
- (All (_ Attribute) (-> (Writer Attribute) (Writer (Code Attribute))))
+(def .public (format format code)
+ (All (_ Attribute) (-> (Format Attribute) (Format (Code Attribute))))
(all binaryF#composite
... u2 max_stack;
... u2 max_locals;
- (///limit.writer (the #limit code))
+ (///limit.format (the #limit code))
... u4 code_length;
... u1 code[code_length];
(binaryF.binary_32 (the #code code))
... u2 exception_table_length;
... exception_table[exception_table_length];
- ((binaryF.sequence_16 /exception.writer) (the #exception_table code))
+ ((binaryF.sequence_16 /exception.format) (the #exception_table code))
... u2 attributes_count;
... attribute_info attributes[attributes_count];
- ((binaryF.sequence_16 writer) (the #attributes code))
+ ((binaryF.sequence_16 format) (the #attributes code))
))
diff --git a/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux b/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux
index a125c1282..08c7cc129 100644
--- a/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux
+++ b/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux
@@ -6,7 +6,7 @@
[data
["[0]" product]
[binary
- ["[0]" \\format (.only Writer)]]]
+ ["[0]" \\format (.only Format)]]]
[math
[number
["n" nat]]]]]
@@ -49,11 +49,11 @@
////unsigned.bytes/2
))
-(def .public writer
- (Writer Exception)
+(def .public format
+ (Format Exception)
(all \\format.and
- ////address.writer
- ////address.writer
- ////address.writer
- ////index.writer
+ ////address.format
+ ////address.format
+ ////address.format
+ ////index.format
))
diff --git a/stdlib/source/library/lux/target/jvm/attribute/constant.lux b/stdlib/source/library/lux/target/jvm/attribute/constant.lux
index 3a31f2c70..830632337 100644
--- a/stdlib/source/library/lux/target/jvm/attribute/constant.lux
+++ b/stdlib/source/library/lux/target/jvm/attribute/constant.lux
@@ -5,7 +5,7 @@
[equivalence (.only Equivalence)]]
[data
[binary
- [\\format (.only Writer)]]]]]
+ [\\format (.only Format)]]]]]
["[0]" ///
[constant (.only Value)]
["[1][0]" index (.only Index)]
@@ -22,6 +22,6 @@
(def .public length
///index.length)
-(def .public writer
- (All (_ a) (Writer (Constant a)))
- ///index.writer)
+(def .public format
+ (All (_ a) (Format (Constant a)))
+ ///index.format)
diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux
index f6a439799..5d407ac59 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode.lux
@@ -140,9 +140,9 @@
(exception.report
"Instruction" (%.symbol instruction)
"Label" (%.nat label)
- "Address" (/address.format address)
- "Expected" (/stack.format expected)
- "Actual" (/stack.format actual)))
+ "Address" (/address.text address)
+ "Expected" (/stack.text expected)
+ "Actual" (/stack.text actual)))
(def .public (set? label)
(-> Label (Bytecode (Maybe [Stack Address])))
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/address.lux b/stdlib/source/library/lux/target/jvm/bytecode/address.lux
index 58a9d411e..f1b07aa77 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/address.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/address.lux
@@ -8,9 +8,9 @@
["[0]" try (.only Try)]]
[data
[binary
- [\\format (.only Writer)]]
+ [\\format (.only Format)]]
[text
- ["%" \\format (.only Format)]]]
+ ["%" \\format]]]
[math
[number
["n" nat]]]
@@ -64,11 +64,11 @@
(representation reference)
(representation subject)))))
- (def .public writer
- (Writer Address)
- (|>> representation ///unsigned.writer/2))
-
(def .public format
(Format Address)
+ (|>> representation ///unsigned.format/2))
+
+ (def .public text
+ (%.Format Address)
(|>> representation ///unsigned.value %.nat))
)
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux
index 82f6f0937..fcb4540c7 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux
@@ -67,8 +67,8 @@
(exception .public (mismatched_stacks [expected Stack
actual Stack])
(exception.report
- "Expected" (/stack.format expected)
- "Actual" (/stack.format actual)))
+ "Expected" (/stack.text expected)
+ "Actual" (/stack.text actual)))
(def .public (continue expected environment)
(-> Stack Environment (Try [Stack Environment]))
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux
index ce98e3228..ce5801345 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux
@@ -9,7 +9,7 @@
[data
["[0]" product]
[binary
- ["[0]" \\format (.only Writer) (.use "[1]#[0]" monoid)]]]
+ ["[0]" \\format (.only Format) (.use "[1]#[0]" monoid)]]]
[math
[number
["n" nat]]]]]
@@ -51,9 +51,9 @@
/registry.equivalence
))
-(def .public (writer limit)
- (Writer Limit)
+(def .public (format limit)
+ (Format Limit)
(all \\format#composite
- (/stack.writer (the #stack limit))
- (/registry.writer (the #registry limit))
+ (/stack.format (the #stack limit))
+ (/registry.format (the #registry limit))
))
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux
index cc989ed02..f1cc6058d 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux
@@ -7,7 +7,7 @@
["[0]" try (.only Try) (.use "[1]#[0]" functor)]]
[data
[binary
- [\\format (.only Writer)]]
+ [\\format (.only Format)]]
[collection
["[0]" list (.use "[1]#[0]" functor mix)]]]
[math
@@ -64,9 +64,9 @@
(|>> representation)
/////unsigned.equivalence))
- (def .public writer
- (Writer Registry)
- (|>> representation /////unsigned.writer/2))
+ (def .public format
+ (Format Registry)
+ (|>> representation /////unsigned.format/2))
(def .public (has needed)
(-> Registry Registry Registry)
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux
index 5d485efb2..daf9da304 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux
@@ -8,9 +8,9 @@
["[0]" try (.only Try)]]
[data
[text
- ["%" \\format (.only Format)]]
+ ["%" \\format]]
[binary
- [\\format (.only Writer)]]]
+ [\\format (.only Format)]]]
[type
[primitive (.except)]]]]
["[0]" /////
@@ -35,9 +35,9 @@
(|>> representation)
/////unsigned.equivalence))
- (def .public writer
- (Writer Stack)
- (|>> representation /////unsigned.writer/2))
+ (def .public format
+ (Format Stack)
+ (|>> representation /////unsigned.format/2))
(def stack
(-> U2 Stack)
@@ -60,8 +60,8 @@
(/////unsigned.max/2 (representation left)
(representation right))))
- (def .public format
- (Format Stack)
+ (def .public text
+ (%.Format Stack)
(|>> representation /////unsigned.value %.nat))
)
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux
index fa61fa2fc..1c654dae9 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux
@@ -100,7 +100,7 @@
[size/4 ..big_jump_size]
)
-(with_template [<shift> <name> <inputT> <writer> <unwrap>]
+(with_template [<shift> <name> <inputT> <format> <unwrap>]
[(with_expansions [<private> (template.symbol ["'" <name>])]
(def (<private> opcode input0)
(-> Opcode <inputT> Mutation)
@@ -108,7 +108,7 @@
[(n.+ (///unsigned.value <shift>) offset)
(|> binary
(binary.has_8! offset opcode)
- (<writer> (n.+ (///unsigned.value ..opcode_size) offset)
+ (<format> (n.+ (///unsigned.value ..opcode_size) offset)
(<unwrap> input0)))]))
(def <name>
@@ -124,7 +124,7 @@
[..size/4 jump/4 Big_Jump binary.has_32! ///signed.value]
)
-(with_template [<shift> <name> <inputT> <writer>]
+(with_template [<shift> <name> <inputT> <format>]
[(with_expansions [<private> (template.symbol ["'" <name>])]
(def (<private> opcode input0)
(-> Opcode <inputT> Mutation)
@@ -132,7 +132,7 @@
[(n.+ (///unsigned.value <shift>) offset)
(|> binary
(binary.has_8! offset opcode)
- (<writer> (n.+ (///unsigned.value ..opcode_size) offset)
+ (<format> (n.+ (///unsigned.value ..opcode_size) offset)
(///signed.value input0)))]))
(def <name>
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/jump.lux b/stdlib/source/library/lux/target/jvm/bytecode/jump.lux
index 8274d3855..13c5f8f07 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/jump.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/jump.lux
@@ -5,7 +5,7 @@
[equivalence (.only Equivalence)]]
[data
[binary
- [\\format (.only Writer)]]]]]
+ [\\format (.only Format)]]]]]
["[0]" ///
[encoding
["[1][0]" signed (.only S2 S4)]]])
@@ -17,9 +17,9 @@
(Equivalence Jump)
///signed.equivalence)
-(def .public writer
- (Writer Jump)
- ///signed.writer/2)
+(def .public format
+ (Format Jump)
+ ///signed.format/2)
(type .public Big_Jump
S4)
diff --git a/stdlib/source/library/lux/target/jvm/class.lux b/stdlib/source/library/lux/target/jvm/class.lux
index 08ef0790a..d018f832f 100644
--- a/stdlib/source/library/lux/target/jvm/class.lux
+++ b/stdlib/source/library/lux/target/jvm/class.lux
@@ -10,7 +10,7 @@
[data
["[0]" product]
["[0]" binary
- ["[1]F" \\format (.only Writer) (.use "[1]#[0]" monoid)]]
+ ["[1]F" \\format (.only Format) (.use "[1]#[0]" monoid)]]
[collection
["[0]" sequence (.only Sequence)]]]]]
["[0]" //
@@ -88,8 +88,8 @@
(in [@this @super @interfaces])))
(def .public (class version modifier
- this signature super interfaces
- fields methods attributes)
+ this signature super interfaces
+ fields methods attributes)
(-> Major (Modifier Class)
Internal (Maybe (Signature Inheritance)) Internal (List Internal)
(List (Resource Field))
@@ -127,25 +127,25 @@
{.#None}
attributes)])))
-(def .public (writer class)
- (Writer Class)
+(def .public (format class)
+ (Format Class)
(`` (all binaryF#composite
- (~~ (with_template [<writer> <slot>]
- [(<writer> (the <slot> class))]
+ (~~ (with_template [<format> <slot>]
+ [(<format> (the <slot> class))]
- [//magic.writer #magic]
- [//version.writer #minor_version]
- [//version.writer #major_version]
- [//pool.writer #constant_pool]
- [//modifier.writer #modifier]
- [//index.writer #this]
- [//index.writer #super]))
- (~~ (with_template [<writer> <slot>]
- [((binaryF.sequence_16 <writer>) (the <slot> class))]
+ [//magic.format #magic]
+ [//version.format #minor_version]
+ [//version.format #major_version]
+ [//pool.format #constant_pool]
+ [//modifier.format #modifier]
+ [//index.format #this]
+ [//index.format #super]))
+ (~~ (with_template [<format> <slot>]
+ [((binaryF.sequence_16 <format>) (the <slot> class))]
- [//index.writer #interfaces]
- [//field.writer #fields]
- [//method.writer #methods]
- [//attribute.writer #attributes]
+ [//index.format #interfaces]
+ [//field.format #fields]
+ [//method.format #methods]
+ [//attribute.format #attributes]
))
)))
diff --git a/stdlib/source/library/lux/target/jvm/constant.lux b/stdlib/source/library/lux/target/jvm/constant.lux
index f404694ea..516930b9d 100644
--- a/stdlib/source/library/lux/target/jvm/constant.lux
+++ b/stdlib/source/library/lux/target/jvm/constant.lux
@@ -11,7 +11,7 @@
["[0]" product]
["[0]" text]
["[0]" binary
- ["[1]F" \\format (.only Writer) (.use "[1]#[0]" monoid)]]]
+ ["[1]F" \\format (.only Format) (.use "[1]#[0]" monoid)]]]
[macro
["^" pattern]
["[0]" template]]
@@ -36,8 +36,8 @@
(type .public UTF8
Text)
-(def utf8_writer
- (Writer UTF8)
+(def utf8_format
+ (Format UTF8)
binaryF.utf8_16)
(primitive .public Class
@@ -57,9 +57,9 @@
..index
//index.equivalence))
- (def class_writer
- (Writer Class)
- (|>> representation //index.writer))
+ (def class_format
+ (Format Class)
+ (|>> representation //index.format))
)
(import java/lang/Float
@@ -112,18 +112,18 @@
[string String (Index UTF8)]
)
- (with_template [<writer_name> <type> <write> <writer>]
- [(def <writer_name>
- (Writer <type>)
+ (with_template [<format_name> <type> <write> <format>]
+ [(def <format_name>
+ (Format <type>)
(`` (|>> representation
(~~ (template.spliced <write>))
- (~~ (template.spliced <writer>)))))]
+ (~~ (template.spliced <format>)))))]
- [integer_writer Integer [] [binaryF.bits_32]]
- [float_writer Float [java/lang/Float::floatToRawIntBits ffi.of_int .i64] [i32.i32 binaryF.bits_32]]
- [long_writer Long [] [binaryF.bits_64]]
- [double_writer Double [java/lang/Double::doubleToRawLongBits ffi.of_long] [binaryF.bits_64]]
- [string_writer String [] [//index.writer]]
+ [integer_format Integer [] [binaryF.bits_32]]
+ [float_format Float [java/lang/Float::floatToRawIntBits ffi.of_int .i64] [i32.i32 binaryF.bits_32]]
+ [long_format Long [] [binaryF.bits_64]]
+ [double_format Double [java/lang/Double::doubleToRawLongBits ffi.of_long] [binaryF.bits_64]]
+ [string_format String [] [//index.format]]
)
)
@@ -137,21 +137,21 @@
[#class (Index Class)
#name_and_type (Index (Name_And_Type of))]))
-(with_template [<type> <equivalence> <writer>]
+(with_template [<type> <equivalence> <format>]
[(def .public <equivalence>
(Equivalence (<type> Any))
(all product.equivalence
//index.equivalence
//index.equivalence))
- (def <writer>
- (Writer (<type> Any))
+ (def <format>
+ (Format (<type> Any))
(all binaryF.and
- //index.writer
- //index.writer))]
+ //index.format
+ //index.format))]
- [Name_And_Type name_and_type_equivalence name_and_type_writer]
- [Reference reference_equivalence reference_writer]
+ [Name_And_Type name_and_type_equivalence name_and_type_format]
+ [Reference reference_equivalence reference_format]
)
(type .public Constant
@@ -223,28 +223,28 @@
... )
)
-(def .public writer
- (Writer Constant)
- (with_expansions [<constants> (these [#UTF8 /tag.utf8 ..utf8_writer]
- [#Integer /tag.integer ..integer_writer]
- [#Float /tag.float ..float_writer]
- [#Long /tag.long ..long_writer]
- [#Double /tag.double ..double_writer]
- [#Class /tag.class ..class_writer]
- [#String /tag.string ..string_writer]
- [#Field /tag.field ..reference_writer]
- [#Method /tag.method ..reference_writer]
- [#Interface_Method /tag.interface_method ..reference_writer]
- [#Name_And_Type /tag.name_and_type ..name_and_type_writer]
+(def .public format
+ (Format Constant)
+ (with_expansions [<constants> (these [#UTF8 /tag.utf8 ..utf8_format]
+ [#Integer /tag.integer ..integer_format]
+ [#Float /tag.float ..float_format]
+ [#Long /tag.long ..long_format]
+ [#Double /tag.double ..double_format]
+ [#Class /tag.class ..class_format]
+ [#String /tag.string ..string_format]
+ [#Field /tag.field ..reference_format]
+ [#Method /tag.method ..reference_format]
+ [#Interface_Method /tag.interface_method ..reference_format]
+ [#Name_And_Type /tag.name_and_type ..name_and_type_format]
... TODO: Method_Handle
... TODO: Method_Type
... TODO: Invoke_Dynamic
)]
(function (_ value)
(case value
- (^.with_template [<case> <tag> <writer>]
+ (^.with_template [<case> <tag> <format>]
[{<case> value}
- (binaryF#composite (/tag.writer <tag>)
- (<writer> value))])
+ (binaryF#composite (/tag.format <tag>)
+ (<format> value))])
(<constants>)
))))
diff --git a/stdlib/source/library/lux/target/jvm/constant/pool.lux b/stdlib/source/library/lux/target/jvm/constant/pool.lux
index ad82d4686..d3a8c2546 100644
--- a/stdlib/source/library/lux/target/jvm/constant/pool.lux
+++ b/stdlib/source/library/lux/target/jvm/constant/pool.lux
@@ -14,7 +14,7 @@
["[0]" product]
["[0]" text]
[binary
- ["[0]" \\format (.only Writer) (.use "specification#[0]" monoid)]]
+ ["[0]" \\format (.only Format) (.use "specification#[0]" monoid)]]
[collection
["[0]" sequence (.only Sequence) (.use "[1]#[0]" mix)]]]
[math
@@ -203,11 +203,11 @@
(template (_ <index>)
[(|> <index> //index.value //unsigned.value)]))
-(def .public writer
- (Writer Pool)
+(def .public format
+ (Format Pool)
(function (_ [next pool])
(sequence#mix (function (_ [_index post] pre)
- (specification#composite pre (//.writer post)))
+ (specification#composite pre (//.format post)))
(\\format.bits_16 (!index next))
pool)))
diff --git a/stdlib/source/library/lux/target/jvm/constant/tag.lux b/stdlib/source/library/lux/target/jvm/constant/tag.lux
index 060628096..2b12af966 100644
--- a/stdlib/source/library/lux/target/jvm/constant/tag.lux
+++ b/stdlib/source/library/lux/target/jvm/constant/tag.lux
@@ -7,7 +7,7 @@
["[0]" try]]
[data
[binary
- [\\format (.only Writer)]]]
+ [\\format (.only Format)]]]
[type
[primitive (.except)]]]]
["[0]" ///
@@ -45,7 +45,7 @@
[18 invoke_dynamic]
)
- (def .public writer
- (Writer Tag)
- (|>> representation ///unsigned.writer/1))
+ (def .public format
+ (Format Tag)
+ (|>> representation ///unsigned.format/1))
)
diff --git a/stdlib/source/library/lux/target/jvm/encoding/signed.lux b/stdlib/source/library/lux/target/jvm/encoding/signed.lux
index c786ae13d..30ec9a567 100644
--- a/stdlib/source/library/lux/target/jvm/encoding/signed.lux
+++ b/stdlib/source/library/lux/target/jvm/encoding/signed.lux
@@ -11,7 +11,7 @@
[text
["%" \\format (.only format)]]
[binary
- ["[0]" \\format (.only Writer)]]]
+ ["[0]" \\format (.only Format)]]]
[macro
["[0]" template]]
[math
@@ -101,13 +101,13 @@
[lifted/4 S2 S4]
)
- (with_template [<writer_name> <type> <writer>]
- [(def .public <writer_name>
- (Writer <type>)
- (|>> representation <writer>))]
+ (with_template [<format_name> <type> <format>]
+ [(def .public <format_name>
+ (Format <type>)
+ (|>> representation <format>))]
- [writer/1 S1 \\format.bits_8]
- [writer/2 S2 \\format.bits_16]
- [writer/4 S4 \\format.bits_32]
+ [format/1 S1 \\format.bits_8]
+ [format/2 S2 \\format.bits_16]
+ [format/4 S4 \\format.bits_32]
)
)
diff --git a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux
index a3c89b40b..eee130b27 100644
--- a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux
+++ b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux
@@ -11,7 +11,7 @@
[text
["%" \\format (.only format)]]
[binary
- ["[0]" \\format (.only Writer)]]]
+ ["[0]" \\format (.only Format)]]]
[macro
["[0]" template]]
[math
@@ -110,13 +110,13 @@
[lifted/4 U2 U4]
)
- (with_template [<writer_name> <type> <writer>]
- [(def .public <writer_name>
- (Writer <type>)
- (|>> representation <writer>))]
+ (with_template [<format_name> <type> <format>]
+ [(def .public <format_name>
+ (Format <type>)
+ (|>> representation <format>))]
- [writer/1 U1 \\format.bits_8]
- [writer/2 U2 \\format.bits_16]
- [writer/4 U4 \\format.bits_32]
+ [format/1 U1 \\format.bits_8]
+ [format/2 U2 \\format.bits_16]
+ [format/4 U4 \\format.bits_32]
)
)
diff --git a/stdlib/source/library/lux/target/jvm/field.lux b/stdlib/source/library/lux/target/jvm/field.lux
index ab9f3ea6e..44cbaee15 100644
--- a/stdlib/source/library/lux/target/jvm/field.lux
+++ b/stdlib/source/library/lux/target/jvm/field.lux
@@ -7,7 +7,7 @@
[data
["[0]" product]
["[0]" binary
- ["[1]F" \\format (.only Writer) (.use "[1]#[0]" monoid)]]
+ ["[1]F" \\format (.only Format) (.use "[1]#[0]" monoid)]]
[collection
["[0]" sequence (.only Sequence)]]]]]
["[0]" //
@@ -49,16 +49,16 @@
//index.equivalence
(sequence.equivalence //attribute.equivalence)))
-(def .public (writer field)
- (Writer Field)
+(def .public (format field)
+ (Format Field)
(`` (all binaryF#composite
- (~~ (with_template [<writer> <slot>]
- [(<writer> (the <slot> field))]
+ (~~ (with_template [<format> <slot>]
+ [(<format> (the <slot> field))]
- [modifier.writer #modifier]
- [//index.writer #name]
- [//index.writer #descriptor]
- [(binaryF.sequence_16 //attribute.writer) #attributes]))
+ [modifier.format #modifier]
+ [//index.format #name]
+ [//index.format #descriptor]
+ [(binaryF.sequence_16 //attribute.format) #attributes]))
)))
(def .public (field modifier name with_signature? type attributes)
diff --git a/stdlib/source/library/lux/target/jvm/index.lux b/stdlib/source/library/lux/target/jvm/index.lux
index e54447e78..1bae3b814 100644
--- a/stdlib/source/library/lux/target/jvm/index.lux
+++ b/stdlib/source/library/lux/target/jvm/index.lux
@@ -5,7 +5,7 @@
["[0]" equivalence (.only Equivalence)]]
[data
[binary
- [\\format (.only Writer)]]]
+ [\\format (.only Format)]]]
[type
[primitive (.except)]]]]
["[0]" //
@@ -32,7 +32,7 @@
..value
//unsigned.equivalence))
- (def .public writer
- (All (_ kind) (Writer (Index kind)))
- (|>> representation //unsigned.writer/2))
+ (def .public format
+ (All (_ kind) (Format (Index kind)))
+ (|>> representation //unsigned.format/2))
)
diff --git a/stdlib/source/library/lux/target/jvm/magic.lux b/stdlib/source/library/lux/target/jvm/magic.lux
index 3aab60bec..e5fc0a09d 100644
--- a/stdlib/source/library/lux/target/jvm/magic.lux
+++ b/stdlib/source/library/lux/target/jvm/magic.lux
@@ -18,5 +18,5 @@
//unsigned.u4
try.trusted))
-(def .public writer
- //unsigned.writer/4)
+(def .public format
+ //unsigned.format/4)
diff --git a/stdlib/source/library/lux/target/jvm/method.lux b/stdlib/source/library/lux/target/jvm/method.lux
index 4468f152d..7fe3c2d7b 100644
--- a/stdlib/source/library/lux/target/jvm/method.lux
+++ b/stdlib/source/library/lux/target/jvm/method.lux
@@ -9,7 +9,7 @@
[data
["[0]" product]
[binary
- ["[0]" \\format (.only Writer) (.use "[1]#[0]" monoid)]]
+ ["[0]" \\format (.only Format) (.use "[1]#[0]" monoid)]]
[collection
["[0]" sequence (.only Sequence)]
["[0]" list]]]]]
@@ -98,14 +98,14 @@
(sequence.equivalence //attribute.equivalence)
))
-(def .public (writer field)
- (Writer Method)
+(def .public (format field)
+ (Format Method)
(`` (all \\format#composite
- (~~ (with_template [<writer> <slot>]
- [(<writer> (the <slot> field))]
+ (~~ (with_template [<format> <slot>]
+ [(<format> (the <slot> field))]
- [//modifier.writer #modifier]
- [//index.writer #name]
- [//index.writer #descriptor]
- [(\\format.sequence_16 //attribute.writer) #attributes]))
+ [//modifier.format #modifier]
+ [//index.format #name]
+ [//index.format #descriptor]
+ [(\\format.sequence_16 //attribute.format) #attributes]))
)))
diff --git a/stdlib/source/library/lux/target/jvm/modifier.lux b/stdlib/source/library/lux/target/jvm/modifier.lux
index ac45136d6..05df8f292 100644
--- a/stdlib/source/library/lux/target/jvm/modifier.lux
+++ b/stdlib/source/library/lux/target/jvm/modifier.lux
@@ -9,7 +9,7 @@
["[0]" try]]
[data
["[0]" binary
- ["[1]F" \\format (.only Writer)]]]
+ ["[1]F" \\format (.only Format)]]]
[macro (.only with_symbols)
[syntax (.only syntax)]
["[0]" code (.only)
@@ -71,9 +71,9 @@
Modifier
(at ..monoid identity))
- (def .public writer
- (All (_ of) (Writer (Modifier of)))
- (|>> representation //unsigned.writer/2))
+ (def .public format
+ (All (_ of) (Format (Modifier of)))
+ (|>> representation //unsigned.format/2))
(def modifier
(-> Nat Modifier)
diff --git a/stdlib/source/library/lux/target/jvm/version.lux b/stdlib/source/library/lux/target/jvm/version.lux
index 9e50f90bf..8e8b82dcc 100644
--- a/stdlib/source/library/lux/target/jvm/version.lux
+++ b/stdlib/source/library/lux/target/jvm/version.lux
@@ -38,5 +38,5 @@
[56 v12]
)
-(def .public writer
- //unsigned.writer/2)
+(def .public format
+ //unsigned.format/2)
diff --git a/stdlib/source/library/lux/tool/compiler.lux b/stdlib/source/library/lux/tool/compiler.lux
index 8d34b580c..1d46450a2 100644
--- a/stdlib/source/library/lux/tool/compiler.lux
+++ b/stdlib/source/library/lux/tool/compiler.lux
@@ -8,7 +8,7 @@
[data
["[0]" text]
["[0]" binary (.only Binary)
- [\\format (.only Writer)]
+ [\\format (.only Format)]
["<[1]>" \\parser (.only Parser)]]]
[world
["[0]" file (.only Path)]]]]
@@ -47,7 +47,7 @@
(Ex (_ state document object)
[state
(Key document)
- (Writer document)
+ (Format document)
(Parser document)
(-> Input (Try (Compilation state document object)))]))
diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux
index d20ddcc8a..0f893a1dc 100644
--- a/stdlib/source/library/lux/tool/compiler/default/platform.lux
+++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux
@@ -18,7 +18,7 @@
["[0]" bit]
["[0]" product]
["[0]" binary (.only Binary)
- ["_" \\format (.only Writer)]]
+ ["_" \\format (.only Format)]]
["[0]" text (.use "[1]#[0]" equivalence)
["%" \\format (.only format)]]
[collection
@@ -95,21 +95,21 @@
<State+> (these (///directive.State+ <type_vars>))
<Bundle> (these (///generation.Bundle <type_vars>))]
- (def (writer //)
+ (def (format //)
(All (_ a)
- (-> (Writer a)
- (Writer [(module.Module a) Registry])))
+ (-> (Format a)
+ (Format [(module.Module a) Registry])))
(all _.and
(all _.and
_.nat
- descriptor.writer
- (document.writer //))
- registry.writer
+ descriptor.format
+ (document.format //))
+ registry.format
))
(def (cache_module context platform @module key format entry)
(All (_ <type_vars> document)
- (-> context.Context <Platform> module.ID (Key document) (Writer document) (archive.Entry document)
+ (-> context.Context <Platform> module.ID (Key document) (Format document) (archive.Entry document)
(Async (Try Any))))
(let [system (the #file_system platform)
write_artifact! (is (-> [artifact.ID (Maybe Text) Binary] (Action Any))
@@ -137,7 +137,7 @@
(the archive.#module)
(has module.#document document))
(the archive.#registry entry)]
- (_.result (..writer format))
+ (_.result (..format format))
(cache/module.cache! system context @module))))))
... TODO: Inline ASAP
@@ -295,7 +295,7 @@
[[state [archive payload]] (|> (..process_runtime archive platform)
(///phase.result' state)
async#in)
- _ (..cache_module context platform 0 $.key $.writer payload)
+ _ (..cache_module context platform 0 $.key $.format payload)
[phase_wrapper state] (with_missing_extensions platform program state)]
(in [state archive phase_wrapper])))))
@@ -705,7 +705,7 @@
(All (_ <type_vars>
state document object)
(-> Import context.Context <Platform> (List _io.Context) (///.Compiler <State+> .Module Any)
- (Key document) (Writer document) (///.Compilation state document object)
+ (Key document) (Format document) (///.Compilation state document object)
(-> (List ///.Custom) descriptor.Module Lux_Importer module.ID (..Context state) descriptor.Module (..Return state))))
(function (_ customs importer import! @module [archive state] module)
(loop (again [[archive state] [archive state]
@@ -780,7 +780,7 @@
(console.write_line report console)))
<else>)))
.let [entry (has [archive.#module module.#descriptor descriptor.#references] all_dependencies entry)]
- _ (..cache_module context platform @module $.key $.writer (as (archive.Entry .Module) entry))]
+ _ (..cache_module context platform @module $.key $.format (as (archive.Entry .Module) entry))]
(async#in (do try.monad
[archive (archive.has module entry archive)]
(in [archive
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux.lux
index b9d334818..14adeb6d6 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux.lux
@@ -5,7 +5,7 @@
["<>" parser]]
[data
["[0]" binary
- ["_" \\format (.only Writer)]
+ ["_" \\format (.only Format)]
["<[1]>" \\parser (.only Parser)]]]
[meta
["[0]" version]]]]
@@ -20,20 +20,20 @@
... TODO: Remove #module_hash, #imports & #module_state ASAP.
... TODO: Not just from this parser, but from the lux.Module type.
-(def .public writer
- (Writer .Module)
- (let [definition (is (Writer Definition)
+(def .public format
+ (Format .Module)
+ (let [definition (is (Format Definition)
(all _.and _.bit _.type _.any))
- labels (is (Writer [Text (List Text)])
+ labels (is (Format [Text (List Text)])
(_.and _.text (_.list _.text)))
- global_type (is (Writer [Bit Type (Either [Text (List Text)]
+ global_type (is (Format [Bit Type (Either [Text (List Text)]
[Text (List Text)])])
(all _.and _.bit _.type (_.or labels labels)))
- global_label (is (Writer .Label)
+ global_label (is (Format .Label)
(all _.and _.bit _.type (_.list _.text) _.nat))
- alias (is (Writer Alias)
+ alias (is (Format Alias)
(_.and _.text _.text))
- global (is (Writer Global)
+ global (is (Format Global)
(all _.or
definition
global_type
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux
index 16cb9e777..4696b3104 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux
@@ -2468,7 +2468,7 @@
(let [signature (signature.inheritance (list#each jvm.signature parameters)
(jvm.signature super)
(list#each jvm.signature interfaces))]
- (try#each (|>> (\\format.result class.writer)
+ (try#each (|>> (\\format.result class.format)
[name])
(class.class version.v6_0
(all modifier#composite
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux
index 05da344e7..39104d42d 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux
@@ -687,7 +687,7 @@
(let [signature (signature.inheritance (list#each type.signature parameters)
(type.signature super)
(list#each type.signature interfaces))]
- (try#each (|>> (\\format.result class.writer)
+ (try#each (|>> (\\format.result class.format)
[name])
(class.class version.v6_0
(all modifier#composite
@@ -904,7 +904,7 @@
(the [directive.#generation directive.#phase] state)])
methods)
.let [all_dependencies (cache.all (list#each product.left methods))]
- bytecode (<| (at ! each (\\format.result class.writer))
+ bytecode (<| (at ! each (\\format.result class.format))
phase.lifted
(class.class version.v6_0
(all modifier#composite
@@ -943,7 +943,7 @@
(function (_ extension_name phase archive [[name parameters] supers annotations method_declarations])
(directive.lifted_generation
(do [! phase.monad]
- [bytecode (<| (at ! each (\\format.result class.writer))
+ [bytecode (<| (at ! each (\\format.result class.format))
phase.lifted
(class.class version.v6_0
(all modifier#composite
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux
index 2cebcc690..73c27d038 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux
@@ -1350,7 +1350,7 @@
methods! (|> overriden_methods
(list#each (normalized_method global_mapping))
(monad.each ! (method_definition generate archive artifact_id)))
- bytecode (<| (at ! each (\\format.result class.writer))
+ bytecode (<| (at ! each (\\format.result class.format))
//////.lifted
(class.class version.v6_0 (all modifier#composite class.public class.final)
(name.internal anonymous_class_name)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux
index 3f2474f4e..200b4db2e 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux
@@ -115,14 +115,14 @@
.let [function_class (//runtime.class_name function_context)]
[fields methods instance] (..with generate archive @begin function_class environment arity bodyG)
class (phase.lifted (class.class version.v6_0
- ..modifier
- (name.internal function_class)
- {.#None}
- (..internal /abstract.class) (list)
- fields
- methods
- (sequence.sequence)))
- .let [bytecode [function_class (\\format.result class.writer class)]]
+ ..modifier
+ (name.internal function_class)
+ {.#None}
+ (..internal /abstract.class) (list)
+ fields
+ methods
+ (sequence.sequence)))
+ .let [bytecode [function_class (\\format.result class.format class)]]
_ (generation.execute! bytecode)
_ (generation.save! (product.right function_context) {.#None} bytecode)]
(in instance)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux
index 61bd54986..9e33db858 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux
@@ -131,7 +131,7 @@
_.return)}))
(sequence.sequence))]
(io.run! (do [! (try.with io.monad)]
- [bytecode (at ! each (\\format.result class.writer)
+ [bytecode (at ! each (\\format.result class.format)
(io.io bytecode))
_ (loader.store eval_class bytecode library)
class (loader.load eval_class loader)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux
index 2a89c066d..f902c5261 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux
@@ -155,14 +155,14 @@
_.return)})
class (artifact_name context)]
[class
- (<| (\\format.result class.writer)
+ (<| (\\format.result class.format)
try.trusted
(class.class version.v6_0
- ..program::modifier
- (name.internal class)
- {.#None}
- super_class
- (list)
- (list)
- (list main)
- (sequence.sequence)))]))
+ ..program::modifier
+ (name.internal class)
+ {.#None}
+ super_class
+ (list)
+ (list)
+ (list main)
+ (sequence.sequence)))]))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux
index a182ed733..7f11b6f25 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux
@@ -545,27 +545,27 @@
(all modifier#composite
class.public
class.final))
- bytecode (<| (\\format.result class.writer)
+ bytecode (<| (\\format.result class.format)
try.trusted
(class.class jvm/version.v6_0
- modifier
- (name.internal class)
- {.#None}
- (name.internal (..reflection ^Object)) (list)
- (list)
- (let [[left_projection::method right_projection::method] projection::method2]
- (list ..decode_frac::method
- ..variant::method
-
- ..pm_failure::method
-
- ..push::method
- ..case::method
- left_projection::method
- right_projection::method
-
- ..try::method))
- sequence.empty))]
+ modifier
+ (name.internal class)
+ {.#None}
+ (name.internal (..reflection ^Object)) (list)
+ (list)
+ (let [[left_projection::method right_projection::method] projection::method2]
+ (list ..decode_frac::method
+ ..variant::method
+
+ ..pm_failure::method
+
+ ..push::method
+ ..case::method
+ left_projection::method
+ right_projection::method
+
+ ..try::method))
+ sequence.empty))]
(do ////.monad
[_ (generation.execute! [class bytecode])
_ (generation.save! ..artifact_id {.#None} [class bytecode])]
@@ -618,16 +618,16 @@
//function/count.field
#0 //function/count.type
sequence.empty))
- bytecode (<| (\\format.result class.writer)
+ bytecode (<| (\\format.result class.format)
try.trusted
(class.class jvm/version.v6_0
- modifier
- (name.internal class)
- {.#None}
- (name.internal (..reflection ^Object)) (list)
- (list partial_count)
- (list.partial <init>::method apply::method+)
- sequence.empty))]
+ modifier
+ (name.internal class)
+ {.#None}
+ (name.internal (..reflection ^Object)) (list)
+ (list partial_count)
+ (list.partial <init>::method apply::method+)
+ sequence.empty))]
(do ////.monad
[_ (generation.execute! [class bytecode])
... _ (generation.save! //function.artifact_id {.#None} [class bytecode])
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux
index 0b4e012cc..fd8a0c817 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux
@@ -13,10 +13,10 @@
[data
["[0]" product]
["[0]" binary (.only Binary)
- ["[0]" \\format (.only Writer)]
+ ["[0]" \\format (.only Format)]
["<[1]>" \\parser (.only Parser)]]
["[0]" text (.only)
- ["%" \\format (.only format)]]
+ ["%" \\format]]
[collection
["[0]" list (.use "[1]#[0]" functor mix)]
["[0]" dictionary (.only Dictionary)]
@@ -226,8 +226,8 @@
<binary>.nat
(<binary>.list (<>.and <binary>.text <binary>.nat))))
- (def writer
- (Writer ..Frozen)
+ (def format
+ (Format ..Frozen)
(all \\format.and
\\format.nat
\\format.nat
@@ -243,7 +243,7 @@
{.#Some _} {.#Some [module id]}
{.#None} {.#None})))
[version /#next]
- (\\format.result ..writer))))
+ (\\format.result ..format))))
(exception .public (version_mismatch [expected Version
actual Version])
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux
index c67c50d15..b3e186b92 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux
@@ -9,7 +9,7 @@
["[0]" product]
["[0]" text]
["[0]" binary
- ["[0]" \\format (.only Writer)]
+ ["[0]" \\format (.only Format)]
["<[1]>" \\parser (.only Parser)]]
[collection
["[0]" set (.only Set)]]]
@@ -61,8 +61,8 @@
set.equivalence
))
-(def .public writer
- (Writer Descriptor)
+(def .public format
+ (Format Descriptor)
(all \\format.and
\\format.text
\\format.text
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux
index 4653591a7..64fae1ab4 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux
@@ -12,7 +12,7 @@
["[0]" dictionary (.only Dictionary)]]
["[0]" binary
[\\parser (.only Parser)]
- ["[1]" \\format (.only Writer)]]]
+ ["[1]" \\format (.only Format)]]]
[type (.only sharing)
[primitive (.except)]]]]
[///
@@ -59,12 +59,12 @@
(-> (Document Any) Signature)
(|>> representation (the #signature)))
- (def .public (writer content)
- (All (_ d) (-> (Writer d) (Writer (Document d))))
- (let [writer (all binary.and
- signature.writer
+ (def .public (format content)
+ (All (_ d) (-> (Format d) (Format (Document d))))
+ (let [format (all binary.and
+ signature.format
content)]
- (|>> representation writer)))
+ (|>> representation format)))
(def .public (parser key it)
(All (_ d) (-> (Key d) (Parser d) (Parser (Document d))))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux
index 9c889fada..f93624fbc 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux
@@ -11,10 +11,10 @@
[data
["[0]" product]
["[0]" binary
- ["[1]" \\format (.only Writer)]
+ ["[1]" \\format (.only Format)]
["<[1]>" \\parser (.only Parser)]]
["[0]" text (.only)
- ["%" \\format (.only format)]]
+ ["%" \\format]]
[collection
[set (.only Set)]
["[0]" list]
@@ -104,9 +104,9 @@
(-> Text Registry (Maybe ID))
(maybe#each product.left (find_definition name registry)))
- (def .public writer
- (Writer Registry)
- (let [definition (is (Writer //category.Definition)
+ (def .public format
+ (Format Registry)
+ (let [definition (is (Format //category.Definition)
(all binary.and
binary.text
(binary.maybe
@@ -116,12 +116,12 @@
binary.nat
))
))
- category (is (Writer Category)
+ category (is (Format Category)
(function (_ value)
(case value
- (^.with_template [<nat> <tag> <writer>]
+ (^.with_template [<nat> <tag> <format>]
[{<tag> value}
- ((binary.and binary.nat <writer>) [<nat> value])])
+ ((binary.and binary.nat <format>) [<nat> value])])
([0 //category.#Anonymous binary.any]
[1 //category.#Definition definition]
[2 //category.#Analyser binary.text]
@@ -130,11 +130,11 @@
[5 //category.#Directive binary.text]
[6 //category.#Custom binary.text]))))
mandatory? binary.bit
- dependency (is (Writer unit.ID)
+ dependency (is (Format unit.ID)
(binary.and binary.nat binary.nat))
- dependencies (is (Writer (Set unit.ID))
+ dependencies (is (Format (Set unit.ID))
(binary.set dependency))
- artifacts (is (Writer (Sequence [Category Bit (Set unit.ID)]))
+ artifacts (is (Format (Sequence [Category Bit (Set unit.ID)]))
(binary.sequence_64 (all binary.and category mandatory? dependencies)))]
(|>> representation
(the #artifacts)
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux
index 086b11c12..e9220d028 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux
@@ -8,10 +8,10 @@
[data
["[0]" product]
["[0]" binary
- ["[1]" \\format (.only Writer)]
+ ["[1]" \\format (.only Format)]
["<[1]>" \\parser (.only Parser)]]
["[0]" text (.only)
- ["%" \\format (.only format)]]]
+ ["%" \\format]]]
[math
[number
["[0]" nat]]]
@@ -33,10 +33,10 @@
(def .public (description signature)
(-> Signature Text)
- (format (%.symbol (the #name signature)) " " (version.format (the #version signature))))
+ (%.format (%.symbol (the #name signature)) " " (version.format (the #version signature))))
-(def .public writer
- (Writer Signature)
+(def .public format
+ (Format Signature)
(all binary.and
(binary.and binary.text binary.text)
binary.nat))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/export.lux b/stdlib/source/library/lux/tool/compiler/meta/export.lux
index 4b0621fb9..942391568 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/export.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/export.lux
@@ -70,6 +70,6 @@
(do [! (try.with async.monad)]
[tar (|> sources
(..library fs)
- (at ! each (binary.result tar.writer)))
+ (at ! each (binary.result tar.format)))
.let [/ (at fs separator)]]
(at fs write (format target / ..file) tar)))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux
index 48ba3ea69..86960acb0 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux
@@ -128,4 +128,4 @@
entries (monad.each ! (..write_module now mapping) order)]
(in (|> entries
sequence.of_list
- (binary.result tar.writer))))))
+ (binary.result tar.format))))))
diff --git a/stdlib/source/polytypic/lux/data/format/json.lux b/stdlib/source/polytypic/lux/data/format/json.lux
index 064e4bcce..4d19b7a64 100644
--- a/stdlib/source/polytypic/lux/data/format/json.lux
+++ b/stdlib/source/polytypic/lux/data/format/json.lux
@@ -79,12 +79,12 @@
(|>> (at nat_codec decoded) (at try.functor each (|>> .int))))))
... Builds a JSON generator for potentially inexistent values.
-(def (nullable writer)
+(def (nullable format)
(All (_ a) (-> (-> a JSON) (-> (Maybe a) JSON)))
(function (_ elem)
(case elem
{.#None} {/.#Null}
- {.#Some value} (writer value))))
+ {.#Some value} (format value))))
(def qty_codec
(All (_ unit)
diff --git a/stdlib/source/program/aedifex/command/deploy/snapshot.lux b/stdlib/source/program/aedifex/command/deploy/snapshot.lux
index 0c490f23f..5f1649bf7 100644
--- a/stdlib/source/program/aedifex/command/deploy/snapshot.lux
+++ b/stdlib/source/program/aedifex/command/deploy/snapshot.lux
@@ -51,7 +51,7 @@
(the /.#sources)
set.list
(export.library fs)
- (at ! each (binary.result tar.writer)))
+ (at ! each (binary.result tar.format)))
pom (at async.monad in (////pom.write profile))
_ (////dependency/deployment.one
remote
diff --git a/stdlib/source/program/aedifex/command/install.lux b/stdlib/source/program/aedifex/command/install.lux
index 93bab2d47..556155636 100644
--- a/stdlib/source/program/aedifex/command/install.lux
+++ b/stdlib/source/program/aedifex/command/install.lux
@@ -69,7 +69,7 @@
(at xml.codec encoded)
(at utf8.codec encoded))]
[///package.#origin {///origin.#Local ""}
- ///package.#library (let [library (binary.result tar.writer package)]
+ ///package.#library (let [library (binary.result tar.format package)]
[library (///dependency/status.verified library)])
///package.#pom [pom
pom_data
diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux
index 38aa5aebc..a38f12ad0 100644
--- a/stdlib/source/test/aedifex/command/deploy.lux
+++ b/stdlib/source/test/aedifex/command/deploy.lux
@@ -90,7 +90,7 @@
(the ///.#sources)
set.list
(export.library fs)
- (at ! each (format.result tar.writer)))
+ (at ! each (format.result tar.format)))
actual_pom (at remote download (///repository/remote.uri (the ///artifact.#version artifact) artifact ///artifact/extension.pom))
actual_library (at remote download (///repository/remote.uri (the ///artifact.#version artifact) artifact ///artifact/extension.lux_library))
diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux
index 4ae5fc849..1389e4620 100644
--- a/stdlib/source/test/lux/data/binary.lux
+++ b/stdlib/source/test/lux/data/binary.lux
@@ -86,7 +86,7 @@
(Equivalence Location)
(implementation
(def (= [expected_module expected_line expected_column]
- [sample_module sample_line sample_column])
+ [sample_module sample_line sample_column])
(and (text#= expected_module sample_module)
(n.= expected_line sample_line)
(n.= expected_column sample_column)))))
@@ -413,7 +413,7 @@
(def \\format
Test
(<| (_.covering \\format._)
- (_.for [\\format.Mutation \\format.Specification \\format.Writer])
+ (_.for [\\format.Mutation \\format.Specification \\format.Format])
(all _.and
(_.for [\\format.monoid]
($monoid.spec ..equivalence \\format.monoid ..random_specification))
diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux
index 5cf8a6d35..349149b22 100644
--- a/stdlib/source/test/lux/data/format/tar.lux
+++ b/stdlib/source/test/lux/data/format/tar.lux
@@ -171,7 +171,7 @@
(|> (do try.monad
[expected_path (/.path expected_path)
tar (|> (sequence.sequence {<tag> expected_path})
- (\\format.result /.writer)
+ (\\format.result /.format)
(<b>.result /.parser))]
(in (case (sequence.list tar)
(pattern (list {<tag> actual_path}))
@@ -200,7 +200,7 @@
/.#group [/.#name /.anonymous
/.#id /.no_id]]
expected_content]})
- (\\format.result /.writer)
+ (\\format.result /.format)
(<b>.result /.parser))]
(in (case (sequence.list tar)
(pattern (list {<tag> [actual_path actual_moment actual_mode actual_ownership actual_content]}))
@@ -258,7 +258,7 @@
/.#group [/.#name /.anonymous
/.#id /.no_id]]
content]})
- (\\format.result /.writer)
+ (\\format.result /.format)
(<b>.result /.parser))]
(in (case (sequence.list tar)
(pattern (list {/.#Normal [_ _ actual_mode _ _]}))
@@ -281,7 +281,7 @@
/.#group [/.#name /.anonymous
/.#id /.no_id]]
content]})
- (\\format.result /.writer)
+ (\\format.result /.format)
(<b>.result /.parser))]
(in (case (sequence.list tar)
(pattern (list {/.#Normal [_ _ actual_mode _ _]}))
@@ -348,7 +348,7 @@
/.#group [/.#name /.anonymous
/.#id /.no_id]]
content]})
- (\\format.result /.writer)
+ (\\format.result /.format)
(<b>.result /.parser))]
(in (case (sequence.list tar)
(pattern (list {/.#Normal [_ _ _ actual_ownership _]}))
@@ -372,7 +372,7 @@
/.#group [/.#name /.anonymous
/.#id /.no_id]]
content]})
- (\\format.result /.writer)
+ (\\format.result /.format)
(<b>.result /.parser))]
(in (case (sequence.list tar)
(pattern (list {/.#Normal [_ _ _ actual_ownership _]}))
@@ -397,14 +397,14 @@
(do random.monad
[_ (in [])]
(all _.and
- (_.coverage [/.writer /.parser]
+ (_.coverage [/.format /.parser]
(|> sequence.empty
- (\\format.result /.writer)
+ (\\format.result /.format)
(<b>.result /.parser)
(at try.monad each sequence.empty?)
(try.else false)))
(_.coverage [/.invalid_end_of_archive]
- (let [dump (\\format.result /.writer sequence.empty)]
+ (let [dump (\\format.result /.format sequence.empty)]
(case (<b>.result /.parser (binary#composite dump dump))
{try.#Success _}
false
diff --git a/stdlib/source/test/lux/extension.lux b/stdlib/source/test/lux/extension.lux
index e23bd23ea..58b5cd3fd 100644
--- a/stdlib/source/test/lux/extension.lux
+++ b/stdlib/source/test/lux/extension.lux
@@ -158,7 +158,7 @@
(for @.jvm (let [$class (jvm/runtime.class_name [module_id artifact_id])]
(<| [$class]
(try.else (binary.empty 0))
- (try#each (binaryF.result class.writer))
+ (try#each (binaryF.result class.format))
(class.class version.v6_0 class.public
(name.internal $class)
{.#None}
diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux
index c282c2250..fd972f3e0 100644
--- a/stdlib/source/test/lux/target/jvm.lux
+++ b/stdlib/source/test/lux/target/jvm.lux
@@ -125,20 +125,20 @@
method_name (random.upper_case 10)]
(in (case (do try.monad
[class (/class.class /version.v6_0 /class.public
- (/name.internal class_name)
- {.#None}
- (/name.internal "java.lang.Object")
- (list)
- (list)
- (list (/method.method ..method_modifier
- method_name
- #0 (/type.method [(list) (list) ..$Object (list)])
- (list)
- {.#Some (do /.monad
- [_ bytecode]
- /.areturn)}))
- (sequence.sequence))
- .let [bytecode (binary.result /class.writer class)
+ (/name.internal class_name)
+ {.#None}
+ (/name.internal "java.lang.Object")
+ (list)
+ (list)
+ (list (/method.method ..method_modifier
+ method_name
+ #0 (/type.method [(list) (list) ..$Object (list)])
+ (list)
+ {.#Some (do /.monad
+ [_ bytecode]
+ /.areturn)}))
+ (sequence.sequence))
+ .let [bytecode (binary.result /class.format class)
loader (/loader.memory (/loader.new_library []))]
_ (/loader.define class_name bytecode loader)
class (io.run! (/loader.load class_name loader))
@@ -872,44 +872,44 @@
constructor::type (/type.method [(list) (list /type.long) /type.void (list)])
static_method "static_method"
bytecode (|> (/class.class /version.v6_0 /class.public
- (/name.internal class_name)
- {.#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 (/method.method /method.private
- constructor
- #0 constructor::type
- (list)
- {.#Some (do /.monad
- [_ /.aload_0
- _ (/.invokespecial ..$Object constructor (/type.method [(list) (list) /type.void (list)]))
- _ (..$Long::literal part0)
- _ (/.putstatic $Self class_field /type.long)
- _ /.aload_0
- _ /.lload_1
- _ (/.putfield $Self object_field /type.long)]
- /.return)})
- (/method.method (all /modifier#composite
- /method.public
- /method.static)
- static_method
- #0 (/type.method [(list) (list) ..$Long (list)])
- (list)
- {.#Some (do /.monad
- [_ (/.new $Self)
- _ /.dup
- _ (..$Long::literal part1)
- _ (/.invokespecial $Self constructor constructor::type)
- _ (/.getfield $Self object_field /type.long)
- _ (/.getstatic $Self class_field /type.long)
- _ /.ladd
- _ ..$Long::wrap]
- /.areturn)}))
- (sequence.sequence))
+ (/name.internal class_name)
+ {.#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 (/method.method /method.private
+ constructor
+ #0 constructor::type
+ (list)
+ {.#Some (do /.monad
+ [_ /.aload_0
+ _ (/.invokespecial ..$Object constructor (/type.method [(list) (list) /type.void (list)]))
+ _ (..$Long::literal part0)
+ _ (/.putstatic $Self class_field /type.long)
+ _ /.aload_0
+ _ /.lload_1
+ _ (/.putfield $Self object_field /type.long)]
+ /.return)})
+ (/method.method (all /modifier#composite
+ /method.public
+ /method.static)
+ static_method
+ #0 (/type.method [(list) (list) ..$Long (list)])
+ (list)
+ {.#Some (do /.monad
+ [_ (/.new $Self)
+ _ /.dup
+ _ (..$Long::literal part1)
+ _ (/.invokespecial $Self constructor constructor::type)
+ _ (/.getfield $Self object_field /type.long)
+ _ (/.getstatic $Self class_field /type.long)
+ _ /.ladd
+ _ ..$Long::wrap]
+ /.areturn)}))
+ (sequence.sequence))
try.trusted
- (binary.result /class.writer))
+ (binary.result /class.format))
loader (/loader.memory (/loader.new_library []))]]
(_.property "PUTSTATIC & PUTFIELD & GETFIELD & GETSTATIC"
(case (do try.monad
@@ -974,67 +974,67 @@
(write_and_read size constructor value literal [*store *load *wrap] test))))))]
(all _.and
(_.context "boolean"
- (array (/.newarray /instruction.t_boolean) $Boolean::random $Boolean::literal [/.bastore /.baload $Boolean::wrap]
- (function (_ expected) (|>> (as Bit) (bit#= (as Bit expected))))))
+ (array (/.newarray /instruction.t_boolean) $Boolean::random $Boolean::literal [/.bastore /.baload $Boolean::wrap]
+ (function (_ expected) (|>> (as Bit) (bit#= (as Bit expected))))))
(_.context "byte"
- (array (/.newarray /instruction.t_byte) $Byte::random $Byte::literal [/.bastore /.baload $Byte::wrap]
- (function (_ expected)
- (for @.old
- (|>> (as java/lang/Byte) ffi.byte_to_long ("jvm leq" (ffi.byte_to_long expected)))
-
- @.jvm
- (|>> (as java/lang/Byte) ffi.byte_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.byte_to_long (as java/lang/Byte expected)))))))))
+ (array (/.newarray /instruction.t_byte) $Byte::random $Byte::literal [/.bastore /.baload $Byte::wrap]
+ (function (_ expected)
+ (for @.old
+ (|>> (as java/lang/Byte) ffi.byte_to_long ("jvm leq" (ffi.byte_to_long expected)))
+
+ @.jvm
+ (|>> (as java/lang/Byte) ffi.byte_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.byte_to_long (as java/lang/Byte expected)))))))))
(_.context "short"
- (array (/.newarray /instruction.t_short) $Short::random $Short::literal [/.sastore /.saload $Short::wrap]
- (function (_ expected)
- (for @.old
- (|>> (as java/lang/Short) ffi.short_to_long ("jvm leq" (ffi.short_to_long expected)))
-
- @.jvm
- (|>> (as java/lang/Short) ffi.short_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.short_to_long (as java/lang/Short expected)))))))))
+ (array (/.newarray /instruction.t_short) $Short::random $Short::literal [/.sastore /.saload $Short::wrap]
+ (function (_ expected)
+ (for @.old
+ (|>> (as java/lang/Short) ffi.short_to_long ("jvm leq" (ffi.short_to_long expected)))
+
+ @.jvm
+ (|>> (as java/lang/Short) ffi.short_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.short_to_long (as java/lang/Short expected)))))))))
(_.context "int"
- (array (/.newarray /instruction.t_int) $Integer::random $Integer::literal [/.iastore /.iaload $Integer::wrap]
- (function (_ expected)
- (for @.old
- (|>> (as java/lang/Integer) ("jvm ieq" (as java/lang/Integer expected)))
-
- @.jvm
- (|>> (as java/lang/Integer) "jvm object cast" ("jvm int =" ("jvm object cast" (as java/lang/Integer expected))))))))
+ (array (/.newarray /instruction.t_int) $Integer::random $Integer::literal [/.iastore /.iaload $Integer::wrap]
+ (function (_ expected)
+ (for @.old
+ (|>> (as java/lang/Integer) ("jvm ieq" (as java/lang/Integer expected)))
+
+ @.jvm
+ (|>> (as java/lang/Integer) "jvm object cast" ("jvm int =" ("jvm object cast" (as java/lang/Integer expected))))))))
(_.context "long"
- (array (/.newarray /instruction.t_long) $Long::random $Long::literal [/.lastore /.laload $Long::wrap]
- (function (_ expected)
- (for @.old
- (|>> (as java/lang/Long) ("jvm leq" expected))
-
- @.jvm
- (|>> (as java/lang/Long) "jvm object cast" ("jvm long =" ("jvm object cast" (as java/lang/Long expected))))))))
+ (array (/.newarray /instruction.t_long) $Long::random $Long::literal [/.lastore /.laload $Long::wrap]
+ (function (_ expected)
+ (for @.old
+ (|>> (as java/lang/Long) ("jvm leq" expected))
+
+ @.jvm
+ (|>> (as java/lang/Long) "jvm object cast" ("jvm long =" ("jvm object cast" (as java/lang/Long expected))))))))
(_.context "float"
- (array (/.newarray /instruction.t_float) ..valid_float $Float::literal [/.fastore /.faload $Float::wrap]
- (function (_ expected)
- (for @.old
- (|>> (as java/lang/Float) ("jvm feq" expected))
-
- @.jvm
- (|>> (as java/lang/Float) "jvm object cast" ("jvm float =" ("jvm object cast" (as java/lang/Float expected))))))))
+ (array (/.newarray /instruction.t_float) ..valid_float $Float::literal [/.fastore /.faload $Float::wrap]
+ (function (_ expected)
+ (for @.old
+ (|>> (as java/lang/Float) ("jvm feq" expected))
+
+ @.jvm
+ (|>> (as java/lang/Float) "jvm object cast" ("jvm float =" ("jvm object cast" (as java/lang/Float expected))))))))
(_.context "double"
- (array (/.newarray /instruction.t_double) ..valid_double $Double::literal [/.dastore /.daload $Double::wrap]
- (function (_ expected)
- (for @.old
- (|>> (as java/lang/Double) ("jvm deq" expected))
-
- @.jvm
- (|>> (as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" (as java/lang/Double expected))))))))
+ (array (/.newarray /instruction.t_double) ..valid_double $Double::literal [/.dastore /.daload $Double::wrap]
+ (function (_ expected)
+ (for @.old
+ (|>> (as java/lang/Double) ("jvm deq" expected))
+
+ @.jvm
+ (|>> (as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" (as java/lang/Double expected))))))))
(_.context "char"
- (array (/.newarray /instruction.t_char) $Character::random $Character::literal [/.castore /.caload $Character::wrap]
- (function (_ expected)
- (for @.old
- (|>> (as java/lang/Character) ("jvm ceq" expected))
-
- @.jvm
- (|>> (as java/lang/Character) "jvm object cast" ("jvm char =" ("jvm object cast" (as java/lang/Character expected))))))))
+ (array (/.newarray /instruction.t_char) $Character::random $Character::literal [/.castore /.caload $Character::wrap]
+ (function (_ expected)
+ (for @.old
+ (|>> (as java/lang/Character) ("jvm ceq" expected))
+
+ @.jvm
+ (|>> (as java/lang/Character) "jvm object cast" ("jvm char =" ("jvm object cast" (as java/lang/Character expected))))))))
(_.context "object"
- (array (/.anewarray ..$String) $String::random $String::literal [/.aastore /.aaload /.nop]
- (function (_ expected) (|>> (as Text) (text#= (as Text expected))))))
+ (array (/.anewarray ..$String) $String::random $String::literal [/.aastore /.aaload /.nop]
+ (function (_ expected) (|>> (as Text) (text#= (as Text expected))))))
(<| (_.context "multi")
(do [! random.monad]
[.let [size (at ! each (|>> (n.% 5) (n.+ 1))
@@ -1351,34 +1351,34 @@
.let [$Self (/type.class class_name (list))]]
(in (case (do try.monad
[class (/class.class /version.v6_0 /class.public
- (/name.internal class_name)
- {.#None}
- (/name.internal "java.lang.Object")
- (list)
- (list)
- (list (/method.method ..method_modifier
- primitive_method_name
- #0 primitive_method_type
- (list)
- {.#Some (do /.monad
- [_ ((the #literal primitive) expected)]
- return)})
- (/method.method ..method_modifier
- object_method_name
- #0 (/type.method [(list) (list) (the #boxed primitive) (list)])
- (list)
- {.#Some (do /.monad
- [_ (/.invokestatic $Self primitive_method_name primitive_method_type)
- _ (case substitute
- {.#None}
- (in [])
-
- {.#Some substitute}
- (substitute expected))
- _ (the #wrap primitive)]
- /.areturn)}))
- (sequence.sequence))
- .let [bytecode (binary.result /class.writer class)
+ (/name.internal class_name)
+ {.#None}
+ (/name.internal "java.lang.Object")
+ (list)
+ (list)
+ (list (/method.method ..method_modifier
+ primitive_method_name
+ #0 primitive_method_type
+ (list)
+ {.#Some (do /.monad
+ [_ ((the #literal primitive) expected)]
+ return)})
+ (/method.method ..method_modifier
+ object_method_name
+ #0 (/type.method [(list) (list) (the #boxed primitive) (list)])
+ (list)
+ {.#Some (do /.monad
+ [_ (/.invokestatic $Self primitive_method_name primitive_method_type)
+ _ (case substitute
+ {.#None}
+ (in [])
+
+ {.#Some substitute}
+ (substitute expected))
+ _ (the #wrap primitive)]
+ /.areturn)}))
+ (sequence.sequence))
+ .let [bytecode (binary.result /class.format class)
loader (/loader.memory (/loader.new_library []))]
_ (/loader.define class_name bytecode loader)
class (io.run! (/loader.load class_name loader))
@@ -1651,85 +1651,85 @@
/.lreturn)})))
interface_bytecode (|> (/class.class /version.v6_0 (all /modifier#composite /class.public /class.abstract /class.interface)
- (/name.internal interface_class)
- {.#None}
- (/name.internal "java.lang.Object")
- (list)
- (list)
- (list (/method.method (all /modifier#composite /method.public /method.abstract)
- interface_method #0 method::type (list) {.#None}))
- (sequence.sequence))
+ (/name.internal interface_class)
+ {.#None}
+ (/name.internal "java.lang.Object")
+ (list)
+ (list)
+ (list (/method.method (all /modifier#composite /method.public /method.abstract)
+ interface_method #0 method::type (list) {.#None}))
+ (sequence.sequence))
try.trusted
- (binary.result /class.writer))
+ (binary.result /class.format))
abstract_bytecode (|> (/class.class /version.v6_0 (all /modifier#composite /class.public /class.abstract)
- (/name.internal abstract_class)
- {.#None}
- (/name.internal "java.lang.Object")
- (list)
- (list)
- (list (/method.method /method.public
- "<init>"
- #0 constructor::type
- (list)
- {.#Some (do /.monad
- [_ /.aload_0
- _ (/.invokespecial ..$Object "<init>" constructor::type)]
- /.return)})
- (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}))
- (sequence.sequence))
+ (/name.internal abstract_class)
+ {.#None}
+ (/name.internal "java.lang.Object")
+ (list)
+ (list)
+ (list (/method.method /method.public
+ "<init>"
+ #0 constructor::type
+ (list)
+ {.#Some (do /.monad
+ [_ /.aload_0
+ _ (/.invokespecial ..$Object "<init>" constructor::type)]
+ /.return)})
+ (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}))
+ (sequence.sequence))
try.trusted
- (binary.result /class.writer))
+ (binary.result /class.format))
invoke (is (-> (Type Class) Text (Bytecode Any))
(function (_ class method)
(do /.monad
[_ /.aload_0]
(/.invokevirtual class method method::type))))
concrete_bytecode (|> (/class.class /version.v6_0 /class.public
- (/name.internal concrete_class)
- {.#None}
- (/name.internal abstract_class)
- (list (/name.internal interface_class))
- (list)
- (list (/method.method /method.public
- "<init>"
- #0 constructor::type
- (list)
- {.#Some (do /.monad
- [_ /.aload_0
- _ (/.invokespecial $Abstract "<init>" constructor::type)]
- /.return)})
- (method virtual_method part1)
- (method overriden_method part2)
- (method abstract_method part3)
- (method interface_method part4)
- (/method.method (all /modifier#composite
- /method.public
- /method.static)
- static_method
- #0 (/type.method [(list) (list) ..$Long (list)])
- (list)
- {.#Some (do /.monad
- [_ (/.new $Concrete)
- _ /.dup
- _ (/.invokespecial $Concrete "<init>" constructor::type)
- _ /.astore_0
- _ (invoke $Abstract inherited_method)
- _ (invoke $Concrete virtual_method)
- _ /.ladd
- _ (invoke $Abstract overriden_method)
- _ /.ladd
- _ /.aload_0 _ (/.invokeinterface $Interface interface_method method::type)
- _ /.ladd
- _ (invoke $Abstract abstract_method)
- _ /.ladd
- _ ..$Long::wrap]
- /.areturn)}))
- (sequence.sequence))
+ (/name.internal concrete_class)
+ {.#None}
+ (/name.internal abstract_class)
+ (list (/name.internal interface_class))
+ (list)
+ (list (/method.method /method.public
+ "<init>"
+ #0 constructor::type
+ (list)
+ {.#Some (do /.monad
+ [_ /.aload_0
+ _ (/.invokespecial $Abstract "<init>" constructor::type)]
+ /.return)})
+ (method virtual_method part1)
+ (method overriden_method part2)
+ (method abstract_method part3)
+ (method interface_method part4)
+ (/method.method (all /modifier#composite
+ /method.public
+ /method.static)
+ static_method
+ #0 (/type.method [(list) (list) ..$Long (list)])
+ (list)
+ {.#Some (do /.monad
+ [_ (/.new $Concrete)
+ _ /.dup
+ _ (/.invokespecial $Concrete "<init>" constructor::type)
+ _ /.astore_0
+ _ (invoke $Abstract inherited_method)
+ _ (invoke $Concrete virtual_method)
+ _ /.ladd
+ _ (invoke $Abstract overriden_method)
+ _ /.ladd
+ _ /.aload_0 _ (/.invokeinterface $Interface interface_method method::type)
+ _ /.ladd
+ _ (invoke $Abstract abstract_method)
+ _ /.ladd
+ _ ..$Long::wrap]
+ /.areturn)}))
+ (sequence.sequence))
try.trusted
- (binary.result /class.writer))
+ (binary.result /class.format))
loader (/loader.memory (/loader.new_library []))]]
(_.property "Class & interface inheritance"
(case (do try.monad
diff --git a/stdlib/source/test/lux/tool/compiler/meta/archive/module/descriptor.lux b/stdlib/source/test/lux/tool/compiler/meta/archive/module/descriptor.lux
index 1357295a1..fd3103d21 100644
--- a/stdlib/source/test/lux/tool/compiler/meta/archive/module/descriptor.lux
+++ b/stdlib/source/test/lux/tool/compiler/meta/archive/module/descriptor.lux
@@ -49,9 +49,9 @@
(_.for [/.Module]
(_.coverage [/.runtime]
(text#= "" /.runtime)))
- (_.coverage [/.writer /.parser]
+ (_.coverage [/.format /.parser]
(|> expected
- (binary.result /.writer)
+ (binary.result /.format)
(<binary>.result /.parser)
(try#each (|>> (at /.equivalence = (has /.#state {.#Cached} expected))))
(try.else false)))
diff --git a/stdlib/source/test/lux/tool/compiler/meta/archive/module/document.lux b/stdlib/source/test/lux/tool/compiler/meta/archive/module/document.lux
index 4637d7f39..b1ab4c5ec 100644
--- a/stdlib/source/test/lux/tool/compiler/meta/archive/module/document.lux
+++ b/stdlib/source/test/lux/tool/compiler/meta/archive/module/document.lux
@@ -79,10 +79,10 @@
{try.#Failure error}
(exception.match? /.invalid_signature error)))))
- (_.coverage [/.writer /.parser]
+ (_.coverage [/.format /.parser]
(|> expected
(/.document key/0)
- (binaryF.result (/.writer binaryF.nat))
+ (binaryF.result (/.format binaryF.nat))
(<binary>.result (/.parser key/0 <binary>.nat))
(pipe.case
{try.#Success it}
diff --git a/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux b/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux
index 2a1732cb8..53d3abd61 100644
--- a/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux
+++ b/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux
@@ -158,12 +158,12 @@
[/.directive /.directives text.equivalence (|>>)]
[/.custom /.customs text.equivalence (|>>)]
))))
- (_.coverage [/.writer /.parser]
+ (_.coverage [/.format /.parser]
(and (~~ (with_template [<new> <expected>' <name>]
[(let [<expected> <expected>'
[@expected before] (<new> <expected> mandatory? expected_dependencies /.empty)]
(|> before
- (binary.result /.writer)
+ (binary.result /.format)
(<binary>.result /.parser)
(try#each (|>> (/.id (<name> <expected>))
(maybe#each (same? @expected))
diff --git a/stdlib/source/test/lux/tool/compiler/meta/archive/signature.lux b/stdlib/source/test/lux/tool/compiler/meta/archive/signature.lux
index 683ed09b4..2d75deca0 100644
--- a/stdlib/source/test/lux/tool/compiler/meta/archive/signature.lux
+++ b/stdlib/source/test/lux/tool/compiler/meta/archive/signature.lux
@@ -46,9 +46,9 @@
(text#= (/.description left) (/.description right)))))
(do random.monad
[expected ..random]
- (_.coverage [/.writer /.parser]
+ (_.coverage [/.format /.parser]
(|> expected
- (binaryF.result /.writer)
+ (binaryF.result /.format)
(<binary>.result /.parser)
(try#each (at /.equivalence = expected))
(try.else false))))
diff --git a/stdlib/source/test/lux/tool/compiler/meta/import.lux b/stdlib/source/test/lux/tool/compiler/meta/import.lux
index 6c98680d0..fc2e79616 100644
--- a/stdlib/source/test/lux/tool/compiler/meta/import.lux
+++ b/stdlib/source/test/lux/tool/compiler/meta/import.lux
@@ -66,35 +66,35 @@
content/1 (tar.content content/1)]
(in (|> (sequence.sequence {tar.#Normal [file/0 now export.mode export.ownership content/0]}
{tar.#Normal [file/1 now export.mode export.ownership content/1]})
- (\\format.result tar.writer))))
+ (\\format.result tar.format))))
(try.else (binary.empty 0)))
library_content/0 (|> (do try.monad
[file/0 (tar.path file/0)
content/0 (tar.content content/0)]
(in (|> (sequence.sequence {tar.#Normal [file/0 now export.mode export.ownership content/0]})
- (\\format.result tar.writer))))
+ (\\format.result tar.format))))
(try.else (binary.empty 0)))
library_content/1 (|> (do try.monad
[file/1 (tar.path file/1)
content/1 (tar.content content/1)]
(in (|> (sequence.sequence {tar.#Normal [file/1 now export.mode export.ownership content/1]})
- (\\format.result tar.writer))))
+ (\\format.result tar.format))))
(try.else (binary.empty 0)))
library_content/-0 (|> (do try.monad
[file/0 (tar.path file/0)
content/0 (tar.content content/0)]
(in (|> (sequence.sequence {tar.#Contiguous [file/0 now export.mode export.ownership content/0]})
- (\\format.result tar.writer))))
+ (\\format.result tar.format))))
(try.else (binary.empty 0)))
library_content/-1 (|> (do try.monad
[file/0 (tar.path file/0)]
(in (|> (sequence.sequence {tar.#Symbolic_Link file/0})
- (\\format.result tar.writer))))
+ (\\format.result tar.format))))
(try.else (binary.empty 0)))
library_content/-2 (|> (do try.monad
[file/0 (tar.path file/0)]
(in (|> (sequence.sequence {tar.#Directory file/0})
- (\\format.result tar.writer))))
+ (\\format.result tar.format))))
(try.else (binary.empty 0)))
imported? (is (-> /.Import Bit)
(function (_ it)