aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/documentation/lux.lux25
-rw-r--r--stdlib/source/documentation/lux/abstract/monad.lux6
-rw-r--r--stdlib/source/documentation/lux/control/concurrency/frp.lux6
-rw-r--r--stdlib/source/documentation/lux/control/function.lux6
-rw-r--r--stdlib/source/documentation/lux/control/parser.lux26
-rw-r--r--stdlib/source/documentation/lux/control/parser/json.lux94
-rw-r--r--stdlib/source/documentation/lux/control/parser/synthesis.lux84
-rw-r--r--stdlib/source/documentation/lux/control/parser/text.lux221
-rw-r--r--stdlib/source/documentation/lux/control/parser/tree.lux72
-rw-r--r--stdlib/source/documentation/lux/control/parser/type.lux142
-rw-r--r--stdlib/source/documentation/lux/control/parser/xml.lux60
-rw-r--r--stdlib/source/documentation/lux/data.lux40
-rw-r--r--stdlib/source/documentation/lux/data/binary.lux91
-rw-r--r--stdlib/source/documentation/lux/data/bit.lux31
-rw-r--r--stdlib/source/documentation/lux/data/collection.lux40
-rw-r--r--stdlib/source/documentation/lux/data/collection/array.lux124
-rw-r--r--stdlib/source/documentation/lux/data/collection/bits.lux86
-rw-r--r--stdlib/source/documentation/lux/data/collection/dictionary.lux107
-rw-r--r--stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux84
-rw-r--r--stdlib/source/documentation/lux/data/collection/dictionary/plist.lux58
-rw-r--r--stdlib/source/documentation/lux/data/collection/list.lux239
-rw-r--r--stdlib/source/documentation/lux/data/collection/queue.lux62
-rw-r--r--stdlib/source/documentation/lux/data/collection/queue/priority.lux41
-rw-r--r--stdlib/source/documentation/lux/data/collection/row.lux86
-rw-r--r--stdlib/source/documentation/lux/data/collection/sequence.lux98
-rw-r--r--stdlib/source/documentation/lux/data/color.lux126
-rw-r--r--stdlib/source/documentation/lux/data/color/named.lux319
-rw-r--r--stdlib/source/library/lux.lux168
-rw-r--r--stdlib/source/library/lux/control/parser/json.lux22
-rw-r--r--stdlib/source/library/lux/control/parser/synthesis.lux9
-rw-r--r--stdlib/source/library/lux/control/parser/text.lux35
-rw-r--r--stdlib/source/library/lux/control/parser/tree.lux4
-rw-r--r--stdlib/source/library/lux/control/parser/type.lux27
-rw-r--r--stdlib/source/library/lux/control/parser/xml.lux9
-rw-r--r--stdlib/source/library/lux/data/binary.lux20
-rw-r--r--stdlib/source/library/lux/data/bit.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/array.lux16
-rw-r--r--stdlib/source/library/lux/data/collection/bits.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary.lux12
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary/ordered.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary/plist.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/list.lux34
-rw-r--r--stdlib/source/library/lux/data/collection/queue.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/row.lux8
-rw-r--r--stdlib/source/library/lux/data/collection/sequence.lux13
-rw-r--r--stdlib/source/library/lux/data/color.lux21
-rw-r--r--stdlib/source/library/lux/data/color/named.lux20
-rw-r--r--stdlib/source/library/lux/ffi.jvm.lux32
-rw-r--r--stdlib/source/library/lux/macro/syntax/definition.lux4
-rw-r--r--stdlib/source/library/lux/math/number/rev.lux1
-rw-r--r--stdlib/source/library/lux/meta.lux7
-rw-r--r--stdlib/source/library/lux/test.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/default/init.lux28
-rw-r--r--stdlib/source/library/lux/tool/compiler/default/platform.lux37
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux1
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis/evaluation.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux5
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux3
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux106
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux13
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/phase.lux3
-rw-r--r--stdlib/source/program/compositor.lux23
-rw-r--r--stdlib/source/test/lux/macro.lux1
-rw-r--r--stdlib/source/test/lux/macro/syntax/definition.lux5
-rw-r--r--stdlib/source/test/lux/meta.lux9
69 files changed, 2645 insertions, 471 deletions
diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux
index 1f30de85c..987d9cce5 100644
--- a/stdlib/source/documentation/lux.lux
+++ b/stdlib/source/documentation/lux.lux
@@ -10,7 +10,27 @@
["." /]]
["." / #_
["#." abstract]
- ["#." control]])
+ ["#." control]
+ ["#." data]
+ ... ["#." debug]
+ ... ["#." documentation]
+ ... ["#." locale]
+ ... ["#." macro
+ ... ["#/." code]]
+ ... ["#." math]
+ ... ["#." meta]
+ ... ["#." program]
+ ... ["#." target]
+ ... ["#." test]
+ ... ["#." time]
+ ... ... ["#." tool] ... TODO: Update & expand tests for this
+ ... ["#." type]
+ ... ["#." world]
+ ... ["#." ffi]
+ ... ["#." extension]
+ ... ["#." target #_
+ ... <target>]
+ ])
(documentation: /.:of
"Generates the type corresponding to a given expression."
@@ -28,7 +48,8 @@
""
[..:of]
[/abstract.documentation
- /control.documentation]))
+ /control.documentation
+ /data.documentation]))
(program: inputs
(io.io (debug.log! ($.documentation ..documentation))))
diff --git a/stdlib/source/documentation/lux/abstract/monad.lux b/stdlib/source/documentation/lux/abstract/monad.lux
index 2d55ff0c5..07318bce9 100644
--- a/stdlib/source/documentation/lux/abstract/monad.lux
+++ b/stdlib/source/documentation/lux/abstract/monad.lux
@@ -25,9 +25,9 @@
"Apply a function with monadic effects to a monadic value and yield a new monadic value."
[(then monad function)])
-(documentation: /.seq
+(documentation: /.all
"Run all the monadic values in the list and produce a list of the base values."
- [(seq monad)])
+ [(all monad)])
(documentation: /.map
"Apply a monadic function to all values in a list."
@@ -48,7 +48,7 @@
[..Monad
..do
..then
- ..seq
+ ..all
..map
..only
..fold]
diff --git a/stdlib/source/documentation/lux/control/concurrency/frp.lux b/stdlib/source/documentation/lux/control/concurrency/frp.lux
index 2500b119d..728e93be5 100644
--- a/stdlib/source/documentation/lux/control/concurrency/frp.lux
+++ b/stdlib/source/documentation/lux/control/concurrency/frp.lux
@@ -32,9 +32,9 @@
"A one-element channel containing the output from an async."
[(of_async async)])
-(documentation: /.fold
+(documentation: /.aggregate
"Asynchronous fold over channels."
- [(fold f init channel)])
+ [(aggregate f init channel)])
(documentation: /.sequential
"Transforms the given list into a channel with the same elements."
@@ -50,7 +50,7 @@
..Subscriber
..only
..of_async
- ..fold
+ ..aggregate
..sequential
($.default /.channel_is_already_closed)
($.default /.functor)
diff --git a/stdlib/source/documentation/lux/control/function.lux b/stdlib/source/documentation/lux/control/function.lux
index 88556dda7..62f7b7374 100644
--- a/stdlib/source/documentation/lux/control/function.lux
+++ b/stdlib/source/documentation/lux/control/function.lux
@@ -36,9 +36,9 @@
[(= ((flipped f) "foo" "bar")
(f "bar" "foo"))])
-(documentation: /.apply
+(documentation: /.on
"Simple 1-argument function application."
- [(apply input function)])
+ [(on input function)])
(.def: .public documentation
(.List $.Module)
@@ -48,7 +48,7 @@
..composite
..constant
..flipped
- ..apply
+ ..on
($.default /.monoid)]
[/contract.documentation
/memo.documentation
diff --git a/stdlib/source/documentation/lux/control/parser.lux b/stdlib/source/documentation/lux/control/parser.lux
index 081c5a792..7c6691d60 100644
--- a/stdlib/source/documentation/lux/control/parser.lux
+++ b/stdlib/source/documentation/lux/control/parser.lux
@@ -15,13 +15,12 @@
["#." cli]
["#." code]
["#." environment]
- ... ["#." json]
- ... ["#." synthesis]
- ... ["#." text]
- ... ["#." tree]
- ... ["#." type]
- ... ["#." xml]
- ])
+ ["#." json]
+ ["#." synthesis]
+ ["#." text]
+ ["#." tree]
+ ["#." type]
+ ["#." xml]])
(documentation: /.Parser
"A generic parser.")
@@ -171,10 +170,9 @@
/cli.documentation
/code.documentation
/environment.documentation
- ... /json.documentation
- ... /synthesis.documentation
- ... /text.documentation
- ... /tree.documentation
- ... /type.documentation
- ... /xml.documentation
- ]))
+ /json.documentation
+ /synthesis.documentation
+ /text.documentation
+ /tree.documentation
+ /type.documentation
+ /xml.documentation]))
diff --git a/stdlib/source/documentation/lux/control/parser/json.lux b/stdlib/source/documentation/lux/control/parser/json.lux
new file mode 100644
index 000000000..8dfa6a8d3
--- /dev/null
+++ b/stdlib/source/documentation/lux/control/parser/json.lux
@@ -0,0 +1,94 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Parser
+ "A JSON parser.")
+
+(documentation: /.result
+ (format "Executes the parser against a JSON object."
+ \n "Verifies that all of the JSON was consumed by the parser.")
+ [(result parser json)])
+
+(documentation: /.any
+ "Just returns the JSON input without applying any logic.")
+
+(template [<name>]
+ [(`` (documentation: <name>
+ (format "Reads a JSON value as " (~~ (template.text [<name>])) ".")))]
+
+ [/.null]
+ [/.boolean]
+ [/.number]
+ [/.string]
+ )
+
+(template [<test> <check> <read>]
+ [(`` (documentation: <test>
+ (format "Asks whether a JSON value is a " (~~ (template.text [<read>])) ".")
+ [(<test> test)]))
+ (`` (documentation: <check>
+ (format "Ensures a JSON value is a " (~~ (template.text [<read>])) ".")
+ [(<check> test)]))]
+
+ [/.boolean? /.boolean! ..boolean]
+ [/.number? /.number! ..number]
+ [/.string? /.string! ..string]
+ )
+
+(documentation: /.nullable
+ "Enhances parser by adding NULL-handling."
+ [(nullable parser)])
+
+(documentation: /.array
+ "Parses the contents of a JSON array."
+ [(array parser)])
+
+(documentation: /.object
+ (format "Parses the contents of a JSON object."
+ \n "Use this with the 'field' combinator.")
+ [(object parser)])
+
+(documentation: /.field
+ (format "Parses a field inside a JSON object."
+ \n "Use this inside the 'object' combinator.")
+ [(field field_name parser)])
+
+(documentation: /.dictionary
+ "Parses a dictionary-like JSON object.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Parser
+ ..result
+ ..any
+
+ ..null
+ ..boolean
+ ..number
+ ..string
+
+ ..boolean? ..boolean!
+ ..number? ..number!
+ ..string? ..string!
+
+ ..nullable
+ ..array
+ ..object
+ ..field
+ ..dictionary
+ ($.default /.unconsumed_input)
+ ($.default /.empty_input)
+ ($.default /.unexpected_value)
+ ($.default /.value_mismatch)]
+ []))
diff --git a/stdlib/source/documentation/lux/control/parser/synthesis.lux b/stdlib/source/documentation/lux/control/parser/synthesis.lux
new file mode 100644
index 000000000..82b3224ea
--- /dev/null
+++ b/stdlib/source/documentation/lux/control/parser/synthesis.lux
@@ -0,0 +1,84 @@
+(.module:
+ [library
+ [lux (#- i64 local function loop)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Parser
+ "A parser for the Lux compiler's synthesis nodes using during optimization.")
+
+(documentation: /.result
+ (format "Executes the parser against the inputs."
+ \n "Ensures all inputs are consumed by the parser.")
+ [(result parser input)])
+
+(documentation: /.any
+ "Yields a synthesis node without subjecting it to any analysis.")
+
+(documentation: /.end!
+ "Ensures there are no more inputs.")
+
+(documentation: /.end?
+ "Checks whether there are no more inputs.")
+
+(template [<query> <assertion>]
+ [(`` (documentation: <query>
+ (format "Queries for a " (~~ (template.text [<query>])) " synthesis node.")))
+ (`` (documentation: <assertion>
+ (format "Checks for a specific " (~~ (template.text [<query>])) " synthesis node.")
+ [(<assertion> expected)]))]
+
+ [/.bit /.bit!]
+ [/.i64 /.i64!]
+ [/.f64 /.f64!]
+ [/.text /.text!]
+ [/.local /.local!]
+ [/.foreign /.foreign!]
+ [/.constant /.constant!]
+ )
+
+(documentation: /.tuple
+ "Parses the contents of a tuple."
+ [(tuple parser)])
+
+(documentation: /.function
+ "Parses the body of a function with the 'expected' arity."
+ [(function expected parser)])
+
+(documentation: /.loop
+ "Parses the initial values and the body of a loop."
+ [(loop init_parsers iteration_parser)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Parser
+ ..result
+ ..any
+ ..end!
+ ..end?
+
+ ..bit ..bit!
+ ..i64 ..i64!
+ ..f64 ..f64!
+ ..text ..text!
+ ..local ..local!
+ ..foreign ..foreign!
+ ..constant ..constant!
+
+ ..tuple
+ ..function
+ ..loop
+ ($.default /.cannot_parse)
+ ($.default /.unconsumed_input)
+ ($.default /.expected_empty_input)
+ ($.default /.wrong_arity)
+ ($.default /.empty_input)]
+ []))
diff --git a/stdlib/source/documentation/lux/control/parser/text.lux b/stdlib/source/documentation/lux/control/parser/text.lux
new file mode 100644
index 000000000..52c1c6b07
--- /dev/null
+++ b/stdlib/source/documentation/lux/control/parser/text.lux
@@ -0,0 +1,221 @@
+(.module:
+ [library
+ [lux (#- and not local)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Offset
+ "An offset into a block of text.")
+
+(documentation: /.Parser
+ "A parser for text.")
+
+(documentation: /.Slice
+ "A slice of a block of text.")
+
+(documentation: /.result
+ (format "Executes a parser against a block of text."
+ \n "Verifies that the entire input has been processed.")
+ [(result parser input)])
+
+(documentation: /.offset
+ "Yields the current offset into the input.")
+
+(documentation: /.any
+ "Yields the next character without applying any logic.")
+
+(documentation: /.any!
+ "Yields the next character (as a slice) without applying any logic.")
+
+(template [<name> <caveat>]
+ [(`` (documentation: <name>
+ (format "Produce a character" (~~ (template.text [<caveat>])) " if the parser fails.")
+ [(<name> parser)]))]
+
+ [/.not ""]
+ [/.not! " (as a slice)"]
+ )
+
+(documentation: /.this
+ "Checks that a specific text shows up in the input."
+ [(this reference)])
+
+(documentation: /.end!
+ "Ensure the parser's input is empty.")
+
+(documentation: /.next
+ "Yields the next character (without consuming it from the input).")
+
+(documentation: /.remaining
+ "Get all of the remaining input (without consuming it).")
+
+(documentation: /.range
+ "Only yields characters within a range."
+ [(range bottom top)])
+
+(template [<name> <desc>]
+ [(documentation: <name>
+ (format "Only yields " <desc> " characters."))]
+
+ [/.upper "uppercase"]
+ [/.lower "lowercase"]
+ [/.decimal "decimal"]
+ [/.octal "octal"]
+ )
+
+(documentation: /.alpha
+ "Yields alphabetic characters.")
+
+(documentation: /.alpha_num
+ "Yields alphanumeric characters.")
+
+(documentation: /.hexadecimal
+ "Yields hexadecimal digits.")
+
+(template [<name> <description_modifier>]
+ [(documentation: <name>
+ (format "Yields characters that are" <description_modifier> " part of a piece of text.")
+ [(<name> options)])]
+
+ [/.one_of ""]
+ [/.none_of " not"]
+ )
+
+(template [<name> <description_modifier>]
+ [(documentation: <name>
+ (format "Yields characters (as a slice) that are" <description_modifier> " part of a piece of text.")
+ [(<name> options)])]
+
+ [/.one_of! ""]
+ [/.none_of! " not"]
+ )
+
+(documentation: /.satisfies
+ "Yields characters that satisfy a predicate."
+ [(satisfies parser)])
+
+(documentation: /.space
+ "Yields white-space.")
+
+(documentation: /.and
+ "Yields the outputs of both parsers composed together."
+ [(and left right)])
+
+(documentation: /.and!
+ "Yields the outputs of both parsers composed together (as a slice)."
+ [(and! left right)])
+
+(template [<text> <slice>]
+ [(`` (documentation: <text>
+ (format "Yields " (~~ (template.text [<name>])) " characters as a single continuous text.")
+ [(<text> parser)]))
+ (`` (documentation: <slice>
+ (format "Yields " (~~ (template.text [<name>])) " characters as a single continuous text (as a slice).")
+ [(<slice> parser)]))]
+
+ [/.some /.some!]
+ [/.many /.many!]
+ )
+
+(template [<text> <slice> <doc_modifier>]
+ [(`` (documentation: <text>
+ (format "Yields " <doc_modifier> " N characters.")
+ [(<text> amount parser)]))
+ (`` (documentation: <slice>
+ (format "Yields " <doc_modifier> " N characters (as a slice).")
+ [(<slice> amount parser)]))]
+
+ [/.exactly /.exactly! "exactly"]
+ [/.at_most /.at_most! "at most"]
+ [/.at_least /.at_least! "at least"]
+ )
+
+(documentation: /.between
+ ""
+ [(between minimum additional parser)])
+
+(documentation: /.between!
+ ""
+ [(between! minimum additional parser)])
+
+(documentation: /.enclosed
+ ""
+ [(enclosed [start end] parser)])
+
+(documentation: /.local
+ "Applies a parser against the given input."
+ [(local local_input parser)])
+
+(documentation: /.slice
+ "Converts a slice to a block of text."
+ [(slice parser)])
+
+(documentation: /.then
+ "Embeds a text parser into an arbitrary parser that yields text."
+ [(then structured text)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Offset
+ ..Parser
+ ..Slice
+ ..result
+ ..offset
+
+ ..any ..any!
+ ..not ..not!
+
+ ..this
+ ..end!
+ ..next
+ ..remaining
+ ..range
+
+ ..upper
+ ..lower
+ ..decimal
+ ..octal
+
+ ..alpha
+ ..alpha_num
+ ..hexadecimal
+
+ ..one_of ..one_of!
+ ..none_of ..none_of!
+
+ ..satisfies
+ ..space
+ ..and ..and!
+
+ ..some ..some!
+ ..many ..many!
+
+
+ ..exactly ..exactly!
+ ..at_most ..at_most!
+ ..at_least ..at_least!
+
+ ..between
+ ..between!
+ ..enclosed
+ ..local
+ ..slice
+ ..then
+
+ ($.default /.unconsumed_input)
+ ($.default /.expected_to_fail)
+ ($.default /.cannot_parse)
+ ($.default /.cannot_slice)
+ ($.default /.cannot_match)
+ ($.default /.character_should_be)
+ ($.default /.character_should_not_be)
+ ($.default /.character_does_not_satisfy_predicate)]
+ []))
diff --git a/stdlib/source/documentation/lux/control/parser/tree.lux b/stdlib/source/documentation/lux/control/parser/tree.lux
new file mode 100644
index 000000000..3c5cf1bf7
--- /dev/null
+++ b/stdlib/source/documentation/lux/control/parser/tree.lux
@@ -0,0 +1,72 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Parser
+ "A parser of arbitrary trees.")
+
+(documentation: /.result'
+ "Applies the parser against a tree zipper."
+ [(result' parser zipper)])
+
+(documentation: /.result
+ "Applies the parser against a tree."
+ [(result parser tree)])
+
+(documentation: /.value
+ "Yields the value inside the current tree node.")
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>)]
+
+ [/.down "Move down."]
+ [/.up "Move up."]
+
+ [/.right "Move to the right."]
+ [/.rightmost "Move to the rightmost node."]
+
+ [/.left "Move to the left."]
+ [/.leftmost "Move to the leftmost node."]
+
+ [/.next "Move to the next node."]
+ [/.end "Move to the last node."]
+
+ [/.previous "Move to the previous node."]
+ [/.start "Move to the root node."]
+ )
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Parser
+ ..result'
+ ..result
+ ..value
+
+ ..down
+ ..up
+
+ ..right
+ ..rightmost
+
+ ..left
+ ..leftmost
+
+ ..next
+ ..end
+
+ ..previous
+ ..start
+
+ ($.default /.cannot_move_further)]
+ []))
diff --git a/stdlib/source/documentation/lux/control/parser/type.lux b/stdlib/source/documentation/lux/control/parser/type.lux
new file mode 100644
index 000000000..0d1785b06
--- /dev/null
+++ b/stdlib/source/documentation/lux/control/parser/type.lux
@@ -0,0 +1,142 @@
+(.module:
+ [library
+ [lux (#- local function)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Env
+ "An environment for type parsing.")
+
+(documentation: /.Parser
+ "A parser of Lux types.")
+
+(documentation: /.fresh
+ "An empty parsing environment.")
+
+(documentation: /.result
+ (format "Applies a parser against a type."
+ \n "Verifies that the parser fully consumes the type's information.")
+ [(result poly type)])
+
+(documentation: /.env
+ "Yields the current parsing environment.")
+
+(documentation: /.next
+ "Inspect a type in the input stream without consuming it.")
+
+(documentation: /.any
+ "Yields a type, without examination.")
+
+(documentation: /.local
+ "Apply a parser to the given inputs."
+ [(local types poly)])
+
+(documentation: /.with_extension
+ ""
+ [(with_extension type poly)])
+
+(template [<name>]
+ [(`` (documentation: <name>
+ (format "Parses the contents of a " (~~ (template.text [<name>])) " type.")
+ [(<name> poly)]))]
+
+ [/.variant]
+ [/.tuple]
+ )
+
+(documentation: /.polymorphic
+ ""
+ [(polymorphic poly)])
+
+(documentation: /.function
+ "Parses a function's inputs and output."
+ [(function in_poly out_poly)])
+
+(documentation: /.applied
+ "Parses a type application."
+ [(applied poly)])
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> expected)])]
+
+ [/.exactly "Parses a type exactly."]
+ [/.sub "Parses a sub type."]
+ [/.super "Parses a super type."]
+ )
+
+(documentation: /.adjusted_idx
+ ""
+ [(adjusted_idx env idx)])
+
+(documentation: /.parameter!
+ ""
+ [(parameter! id)])
+
+(documentation: /.existential
+ "Yields an existential type.")
+
+(documentation: /.named
+ "Yields a named type.")
+
+(documentation: /.recursive
+ ""
+ [(recursive poly)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ (format "Parsing of Lux types."
+ \n "Used mostly for polytypic programming.")
+ [..Env
+ ..Parser
+ ..fresh
+ ..result
+ ..env
+ ..next
+ ..any
+ ..local
+ ..with_extension
+
+ ..variant
+ ..tuple
+
+ ..polymorphic
+ ..function
+ ..applied
+
+ ..exactly
+ ..sub
+ ..super
+
+ ..adjusted_idx
+ ..parameter!
+ ..existential
+ ..named
+ ..recursive
+
+ ($.default /.not_existential)
+ ($.default /.not_recursive)
+ ($.default /.not_named)
+ ($.default /.not_parameter)
+ ($.default /.unknown_parameter)
+ ($.default /.not_function)
+ ($.default /.not_application)
+ ($.default /.not_polymorphic)
+ ($.default /.not_variant)
+ ($.default /.not_tuple)
+ ($.default /.types_do_not_match)
+ ($.default /.wrong_parameter)
+ ($.default /.empty_input)
+ ($.default /.unconsumed_input)
+ ($.default /.parameter)
+ ($.default /.recursive_self)
+ ($.default /.recursive_call)]
+ []))
diff --git a/stdlib/source/documentation/lux/control/parser/xml.lux b/stdlib/source/documentation/lux/control/parser/xml.lux
new file mode 100644
index 000000000..71390acdb
--- /dev/null
+++ b/stdlib/source/documentation/lux/control/parser/xml.lux
@@ -0,0 +1,60 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Parser
+ "A parser of XML-encoded data.")
+
+(documentation: /.result
+ (format "Applies a parser against a stream of XML documents."
+ \n "Verifies that all of the inputs are consumed by the parser.")
+ [(result parser documents)])
+
+(documentation: /.text
+ "Yields text from a text node.")
+
+(documentation: /.tag
+ "Yields the tag from the next node.")
+
+(documentation: /.attribute
+ "Yields the value of an attribute in the current node."
+ [(attribute name)])
+
+(documentation: /.node
+ "Parses the contents of the next node if the tag matches."
+ [(node expected parser)])
+
+(documentation: /.any
+ "Yields the next node.")
+
+(documentation: /.somewhere
+ "Applies the parser somewhere among the remaining inputs; instead of demanding that the parser succeeds against the immediate inputs."
+ [(somewhere parser)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Parser
+ ..result
+ ..text
+ ..tag
+ ..attribute
+ ..node
+ ..any
+ ..somewhere
+ ($.default /.empty_input)
+ ($.default /.unexpected_input)
+ ($.default /.wrong_tag)
+ ($.default /.unknown_attribute)
+ ($.default /.unconsumed_inputs)
+ ($.default /.nowhere)]
+ []))
diff --git a/stdlib/source/documentation/lux/data.lux b/stdlib/source/documentation/lux/data.lux
new file mode 100644
index 000000000..0939016a1
--- /dev/null
+++ b/stdlib/source/documentation/lux/data.lux
@@ -0,0 +1,40 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text (#+ \n)
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ ["." / #_
+ ["#." binary]
+ ["#." bit]
+ ["#." collection]
+ ["#." color]
+ ... ["#." identity]
+ ... ["#." name]
+ ... ["#." product]
+ ... ["#." sum]
+ ... ["#." text]
+ ... ["#." format #_
+ ... ["#/." binary]
+ ... ["#/." json]
+ ... ["#/." tar]
+ ... ["#/." xml]]
+ ])
+
+(.def: .public documentation
+ (.List $.Module)
+ (list.together
+ (list /binary.documentation
+ /bit.documentation
+ /collection.documentation
+ /color.documentation
+ ... /identity.documentation
+ ... /name.documentation
+ ... /product.documentation
+ ... /sum.documentation
+ ... /text.documentation
+ ... /format.documentation
+ )))
diff --git a/stdlib/source/documentation/lux/data/binary.lux b/stdlib/source/documentation/lux/data/binary.lux
new file mode 100644
index 000000000..c740e6660
--- /dev/null
+++ b/stdlib/source/documentation/lux/data/binary.lux
@@ -0,0 +1,91 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Binary
+ "A binary BLOB of data.")
+
+(documentation: /.empty
+ "A fresh/empty binary BLOB of the specified size."
+ [(empty size)])
+
+(documentation: /.aggregate
+ ""
+ [(aggregate f init binary)])
+
+(documentation: /.read/8!
+ "Read 1 byte (8 bits) at the given index."
+ [(read/8! index binary)])
+
+(documentation: /.read/16!
+ "Read 2 bytes (16 bits) at the given index."
+ [(read/16! index binary)])
+
+(documentation: /.read/32!
+ "Read 4 bytes (32 bits) at the given index."
+ [(read/32! index binary)])
+
+(documentation: /.read/64!
+ "Read 8 bytes (64 bits) at the given index."
+ [(read/64! index binary)])
+
+(documentation: /.write/8!
+ "Write 1 byte (8 bits) at the given index."
+ [(write/8! index value binary)])
+
+(documentation: /.write/16!
+ "Write 2 bytes (16 bits) at the given index."
+ [(write/16! index value binary)])
+
+(documentation: /.write/32!
+ "Write 4 bytes (32 bits) at the given index."
+ [(write/32! index value binary)])
+
+(documentation: /.write/64!
+ "Write 8 bytes (64 bits) at the given index."
+ [(write/64! index value binary)])
+
+(documentation: /.copy
+ "Mutates the target binary BLOB by copying bytes from the source BLOB to it."
+ [(copy bytes source_offset source target_offset target)])
+
+(documentation: /.slice
+ "Yields a subset of the binary BLOB, so long as the specified range is valid."
+ [(slice offset length binary)])
+
+(documentation: /.after
+ "Yields a binary BLOB with at most the specified number of bytes removed."
+ [(after bytes binary)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Binary
+ ..empty
+ ..aggregate
+ ..read/8!
+ ..read/16!
+ ..read/32!
+ ..read/64!
+ ..write/8!
+ ..write/16!
+ ..write/32!
+ ..write/64!
+ ..copy
+ ..slice
+ ..after
+ ($.default /.index_out_of_bounds)
+ ($.default /.slice_out_of_bounds)
+ ($.default /.size)
+ ($.default /.equivalence)
+ ($.default /.monoid)]
+ []))
diff --git a/stdlib/source/documentation/lux/data/bit.lux b/stdlib/source/documentation/lux/data/bit.lux
new file mode 100644
index 000000000..e1379b85c
--- /dev/null
+++ b/stdlib/source/documentation/lux/data/bit.lux
@@ -0,0 +1,31 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.complement
+ (format "Generates the complement of a predicate."
+ \n "That is a predicate that returns the oposite of the original predicate."))
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..complement
+ ($.default /.no)
+ ($.default /.yes)
+ ($.default /.off)
+ ($.default /.on)
+ ($.default /.equivalence)
+ ($.default /.hash)
+ ($.default /.disjunction)
+ ($.default /.conjunction)
+ ($.default /.codec)]
+ []))
diff --git a/stdlib/source/documentation/lux/data/collection.lux b/stdlib/source/documentation/lux/data/collection.lux
new file mode 100644
index 000000000..e96f59465
--- /dev/null
+++ b/stdlib/source/documentation/lux/data/collection.lux
@@ -0,0 +1,40 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text (#+ \n)
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ ["." / #_
+ ["#." array]
+ ["#." bits]
+ ["#." dictionary]
+ ["#." list]
+ ["#." queue]
+ ["#." row]
+ ["#." sequence]
+ ... ["#." stack]
+ ... ["#." set
+ ... ["#/." multi]
+ ... ["#/." ordered]]
+ ... ["#." tree
+ ... ["#/." finger]
+ ... ["#/." zipper]]
+ ])
+
+(.def: .public documentation
+ (.List $.Module)
+ (list.together
+ (list /array.documentation
+ /bits.documentation
+ /dictionary.documentation
+ /list.documentation
+ /queue.documentation
+ /row.documentation
+ /sequence.documentation
+ ... /stack.documentation
+ ... /set.documentation
+ ... /tree.documentation
+ )))
diff --git a/stdlib/source/documentation/lux/data/collection/array.lux b/stdlib/source/documentation/lux/data/collection/array.lux
new file mode 100644
index 000000000..3bf22b587
--- /dev/null
+++ b/stdlib/source/documentation/lux/data/collection/array.lux
@@ -0,0 +1,124 @@
+(.module:
+ [library
+ [lux (#- example list)
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ [syntax (#+ syntax:)]
+ ["." code]
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Array
+ "Mutable arrays.")
+
+(documentation: /.empty
+ "An empty array of the specified size."
+ [(empty size)])
+
+(documentation: /.size
+ ""
+ [(size array)])
+
+(documentation: /.read!
+ ""
+ [(read! index array)])
+
+(documentation: /.write!
+ "Mutate the array by writing a value to the specified index."
+ [(write! index value array)])
+
+(documentation: /.delete!
+ "Mutate the array by deleting the value at the specified index."
+ [(delete! index array)])
+
+(documentation: /.contains?
+ ""
+ [(contains? index array)])
+
+(documentation: /.update!
+ "Mutate the array by updating the value at the specified index."
+ [(update! index transform array)])
+
+(documentation: /.upsert!
+ (format "Mutate the array by updating the value at the specified index."
+ \n "If there is no value, update and write the default value given.")
+ [(upsert! index default transform array)])
+
+(documentation: /.copy!
+ "Writes the contents of one array into the other."
+ [(copy! length src_start src_array dest_start dest_array)])
+
+(documentation: /.occupancy
+ "Finds out how many cells in an array are occupied."
+ [(occupancy array)])
+
+(documentation: /.vacancy
+ "Finds out how many cells in an array are vacant."
+ [(vacancy array)])
+
+(documentation: /.filter!
+ "Delete every item of the array that fails to satisfy the predicate."
+ [(filter! p xs)])
+
+(documentation: /.example
+ "Yields the first item in the array that satisfies the predicate."
+ [(example p xs)])
+
+(documentation: /.example+
+ "Just like 'example', but with access to the index of each value."
+ [(example+ p xs)])
+
+(documentation: /.clone
+ "Yields a shallow clone of the array."
+ [(clone xs)])
+
+(documentation: /.of_list
+ ""
+ [(of_list xs)])
+
+(documentation: /.list
+ "Yields a list with every non-empty item in the array."
+ [(list array)])
+
+(documentation: /.list'
+ "Like 'list', but uses the 'default' value when encountering an empty cell in the array."
+ [(list' default array)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Array
+ ..empty
+ ..size
+ ..read!
+ ..write!
+ ..delete!
+ ..contains?
+ ..update!
+ ..upsert!
+ ..copy!
+ ..occupancy
+ ..vacancy
+ ..filter!
+ ..example
+ ..example+
+ ..clone
+ ..of_list
+ ..list
+ ..list'
+ ($.default /.type_name)
+ ($.default /.equivalence)
+ ($.default /.monoid)
+ ($.default /.functor)
+ ($.default /.fold)
+ ($.default /.every?)
+ ($.default /.any?)]
+ []))
diff --git a/stdlib/source/documentation/lux/data/collection/bits.lux b/stdlib/source/documentation/lux/data/collection/bits.lux
new file mode 100644
index 000000000..f5fe95dc3
--- /dev/null
+++ b/stdlib/source/documentation/lux/data/collection/bits.lux
@@ -0,0 +1,86 @@
+(.module:
+ [library
+ [lux (#- or and not)
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ [syntax (#+ syntax:)]
+ ["." code]
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Bits
+ "A bit-map.")
+
+(documentation: /.size
+ "Measures the size of a bit-map by counting all the 1s in the bit-map."
+ [(size bits)])
+
+(documentation: /.capacity
+ ""
+ [(capacity bits)])
+
+(documentation: /.bit
+ ""
+ [(bit index bits)])
+
+(template [<name>]
+ [(documentation: <name>
+ ""
+ [(<name> index input)])]
+
+ [/.one]
+ [/.zero]
+ [/.flipped]
+ )
+
+(documentation: /.intersects?
+ ""
+ [(intersects? reference sample)])
+
+(documentation: /.not
+ ""
+ [(not input)])
+
+(template [<name>]
+ [(documentation: <name>
+ ""
+ [(<name> param subject)])]
+
+ [/.and]
+ [/.or]
+ [/.xor]
+ )
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Bits
+ ..size
+ ..capacity
+ ..bit
+
+ ..one
+ ..zero
+ ..flipped
+
+ ..intersects?
+ ..not
+
+ ..and
+ ..or
+ ..xor
+
+ ($.default /.Chunk)
+ ($.default /.chunk_size)
+ ($.default /.empty)
+ ($.default /.empty?)
+ ($.default /.equivalence)]
+ []))
diff --git a/stdlib/source/documentation/lux/data/collection/dictionary.lux b/stdlib/source/documentation/lux/data/collection/dictionary.lux
new file mode 100644
index 000000000..95d2f998a
--- /dev/null
+++ b/stdlib/source/documentation/lux/data/collection/dictionary.lux
@@ -0,0 +1,107 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ [syntax (#+ syntax:)]
+ ["." code]
+ ["." template]]]]
+ [\\library
+ ["." /]]
+ ["." / #_
+ ["#." ordered]
+ ["#." plist]])
+
+(documentation: /.Dictionary
+ "A dictionary implemented as a Hash-Array Mapped Trie (HAMT).")
+
+(documentation: /.empty
+ "An empty dictionary."
+ [(empty key_hash)])
+
+(documentation: /.has
+ ""
+ [(has key val dict)])
+
+(documentation: /.lacks
+ ""
+ [(lacks key dict)])
+
+(documentation: /.value
+ ""
+ [(value key dict)])
+
+(documentation: /.key?
+ ""
+ [(key? dict key)])
+
+(documentation: /.has'
+ "Only puts the KV-pair if the key is not already present."
+ [(has' key val dict)])
+
+(documentation: /.revised
+ "Transforms the value located at key (if available), using the given function."
+ [(revised key f dict)])
+
+(documentation: /.revised'
+ (format "Updates the value at the key; if it exists."
+ \n "Otherwise, puts a value by applying the function to a default.")
+ [(revised' key default f dict)])
+
+(documentation: /.of_list
+ ""
+ [(of_list key_hash kvs)])
+
+(documentation: /.merged
+ (format "Merges 2 dictionaries."
+ \n "If any collisions with keys occur, the values of dict2 will overwrite those of dict1.")
+ [(merged dict2 dict1)])
+
+(documentation: /.merged_with
+ (format "Merges 2 dictionaries."
+ \n "If any collisions with keys occur, a new value will be computed by applying 'f' to the values of dict2 and dict1.")
+ [(merged_with f dict2 dict1)])
+
+(documentation: /.re_bound
+ "If there is a value under 'from_key', remove 'from_key' and store the value under 'to_key'."
+ [(re_bound from_key to_key dict)])
+
+(documentation: /.sub
+ "A sub-dictionary, with only the specified keys."
+ [(sub keys dict)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Dictionary
+ ..empty
+ ..has
+ ..lacks
+ ..value
+ ..key?
+ ..has'
+ ..revised
+ ..revised'
+ ..of_list
+ ..merged
+ ..merged_with
+ ..re_bound
+ ..sub
+ ($.default /.key_hash)
+ ($.default /.key_already_exists)
+ ($.default /.size)
+ ($.default /.empty?)
+ ($.default /.entries)
+ ($.default /.keys)
+ ($.default /.values)
+ ($.default /.equivalence)
+ ($.default /.functor)]
+ [/ordered.documentation
+ /plist.documentation]))
diff --git a/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux
new file mode 100644
index 000000000..adbb1303f
--- /dev/null
+++ b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux
@@ -0,0 +1,84 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ [syntax (#+ syntax:)]
+ ["." code]
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Dictionary
+ "A dictionary data-structure with ordered entries.")
+
+(documentation: /.empty
+ "An empty dictionary, employing the given order."
+ [(empty order)])
+
+(documentation: /.value
+ ""
+ [(value key dict)])
+
+(documentation: /.key?
+ ""
+ [(key? dict key)])
+
+(template [<name>]
+ [(`` (documentation: <name>
+ (format "Yields value under the " (~~ (template.text [<name>])) "imum key.")
+ [(<name> dict)]))]
+
+ [/.min]
+ [/.max]
+ )
+
+(documentation: /.size
+ ""
+ [(size dict)])
+
+(documentation: /.has
+ ""
+ [(has key value dict)])
+
+(documentation: /.lacks
+ ""
+ [(lacks key dict)])
+
+(documentation: /.revised
+ ""
+ [(revised key transform dict)])
+
+(documentation: /.of_list
+ ""
+ [(of_list order list)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Dictionary
+ ..empty
+ ..value
+ ..key?
+
+ ..min
+ ..max
+
+ ..size
+ ..has
+ ..lacks
+ ..revised
+ ..of_list
+ ($.default /.empty?)
+ ($.default /.entries)
+ ($.default /.keys)
+ ($.default /.values)
+ ($.default /.equivalence)]
+ []))
diff --git a/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux b/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux
new file mode 100644
index 000000000..2450cc9eb
--- /dev/null
+++ b/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux
@@ -0,0 +1,58 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ [syntax (#+ syntax:)]
+ ["." code]
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.PList
+ (format "A property list."
+ \n "It's a simple dictionary-like structure with Text keys."))
+
+(documentation: /.value
+ ""
+ [(value key properties)])
+
+(documentation: /.contains?
+ ""
+ [(contains? key properties)])
+
+(documentation: /.has
+ ""
+ [(has key val properties)])
+
+(documentation: /.revised
+ ""
+ [(revised key f properties)])
+
+(documentation: /.lacks
+ ""
+ [(lacks key properties)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..PList
+ ..value
+ ..contains?
+ ..has
+ ..revised
+ ..lacks
+ ($.default /.empty)
+ ($.default /.size)
+ ($.default /.empty?)
+ ($.default /.keys)
+ ($.default /.values)
+ ($.default /.equivalence)]
+ []))
diff --git a/stdlib/source/documentation/lux/data/collection/list.lux b/stdlib/source/documentation/lux/data/collection/list.lux
new file mode 100644
index 000000000..1050ab7ce
--- /dev/null
+++ b/stdlib/source/documentation/lux/data/collection/list.lux
@@ -0,0 +1,239 @@
+(.module:
+ [library
+ [lux (#- example)
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ [syntax (#+ syntax:)]
+ ["." code]
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.aggregates
+ ""
+ [(aggregates f init inputs)])
+
+(documentation: /.reversed
+ ""
+ [(reversed xs)])
+
+(documentation: /.only
+ "A list with only values that satisfy the predicate."
+ [(only keep? xs)])
+
+(documentation: /.partition
+ "Divide the list into all elements that satisfy a predicate, and all elements that do not."
+ [(partition satisfies? list)])
+
+(documentation: /.pairs
+ (format "Cut the list into pairs of 2."
+ \n "Caveat emptor: If the list has an un-even number of elements, the last one will be skipped.")
+ [(pairs xs)])
+
+(template [<name>]
+ [(documentation: <name>
+ ""
+ [(<name> n xs)])]
+
+ [/.first]
+ [/.after]
+ )
+
+(template [<name>]
+ [(documentation: <name>
+ ""
+ [(<name> predicate xs)])]
+
+ [/.while]
+ [/.until]
+ )
+
+(documentation: /.split_at
+ ""
+ [(split_at n xs)])
+
+(documentation: /.split_when
+ "Segment the list by using a predicate to tell when to cut."
+ [(split_when predicate xs)])
+
+(documentation: /.sub
+ "Segment the list into sub-lists of (at most) the given size."
+ [(sub size list)])
+
+(documentation: /.repeated
+ "A list of the value x, repeated n times."
+ [(repeated n x)])
+
+(documentation: /.iterations
+ "Generates a list element by element until the function returns #.None."
+ [(iterations f x)])
+
+(documentation: /.one
+ ""
+ [(one check xs)])
+
+(documentation: /.all
+ ""
+ [(all check xs)])
+
+(documentation: /.example
+ "Yields the first value in the list that satisfies the predicate."
+ [(example predicate xs)])
+
+(documentation: /.interposed
+ "Puts a value between every two elements in the list."
+ [(interposed sep xs)])
+
+(documentation: /.size
+ ""
+ [(size list)])
+
+(template [<name>]
+ [(documentation: <name>
+ ""
+ [(<name> predicate items)])]
+
+ [/.every?]
+ [/.any?]
+ )
+
+(documentation: /.item
+ "Fetches the element at the specified index."
+ [(item i xs)])
+
+(documentation: /.sorted
+ "A list ordered by a comparison function."
+ [(sorted < xs)])
+
+(documentation: /.empty?
+ ""
+ [(empty? xs)])
+
+(documentation: /.member?
+ ""
+ [(member? eq xs x)])
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> xs)])]
+
+ [/.head "Yields the first element of a list."]
+ [/.tail "For a list of size N, yields the N-1 elements after the first one."]
+ )
+
+(documentation: /.indices
+ "Produces all the valid indices for a given size."
+ [(indices size)])
+
+(documentation: /.zipped
+ "Create list zippers with the specified number of input lists."
+ [(def: zipped/2 (zipped 2))
+ (def: zipped/3 (zipped 3))
+ (zipped/3 xs ys zs)
+ ((zipped 3) xs ys zs)])
+
+(documentation: /.zipped_with
+ "Create list zippers with the specified number of input lists."
+ [(def: zipped_with/2 (zipped_with 2))
+ (def: zipped_with/3 (zipped_with 3))
+ (zipped_with/2 + xs ys)
+ ((zipped_with 2) + xs ys)])
+
+(documentation: /.last
+ ""
+ [(last xs)])
+
+(documentation: /.inits
+ (format "For a list of size N, yields the first N-1 elements."
+ \n "Will yield a #.None for empty lists.")
+ [(inits xs)])
+
+(documentation: /.together
+ "The sequential combination of all the lists.")
+
+(documentation: /.with
+ "Enhances a monad with List functionality."
+ [(with monad)])
+
+(documentation: /.lifted
+ "Wraps a monadic value with List machinery."
+ [(lifted monad)])
+
+(documentation: /.enumeration
+ "Pairs every element in the list with its index, starting at 0."
+ [(enumeration xs)])
+
+(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 /._
+ ""
+ [..aggregates
+ ..reversed
+ ..only
+ ..partition
+ ..pairs
+
+ ..first
+ ..after
+
+ ..while
+ ..until
+
+ ..split_at
+ ..split_when
+ ..sub
+ ..repeated
+ ..iterations
+ ..one
+ ..all
+ ..example
+ ..interposed
+ ..size
+
+ ..every?
+ ..any?
+
+ ..item
+ ..sorted
+ ..empty?
+ ..member?
+
+ ..head
+ ..tail
+
+ ..indices
+ ..zipped
+ ..zipped_with
+ ..last
+ ..inits
+ ..together
+ ..with
+ ..lifted
+ ..enumeration
+ ..when
+ ($.default /.fold)
+ ($.default /.equivalence)
+ ($.default /.hash)
+ ($.default /.monoid)
+ ($.default /.functor)
+ ($.default /.apply)
+ ($.default /.monad)
+ ($.default /.zipped/2)
+ ($.default /.zipped/3)
+ ($.default /.zipped_with/2)
+ ($.default /.zipped_with/3)]
+ []))
diff --git a/stdlib/source/documentation/lux/data/collection/queue.lux b/stdlib/source/documentation/lux/data/collection/queue.lux
new file mode 100644
index 000000000..5b866fe90
--- /dev/null
+++ b/stdlib/source/documentation/lux/data/collection/queue.lux
@@ -0,0 +1,62 @@
+(.module:
+ [library
+ [lux (#- list)
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ [syntax (#+ syntax:)]
+ ["." code]
+ ["." template]]]]
+ [\\library
+ ["." /]]
+ ["." / #_
+ ["#." priority]])
+
+(documentation: /.Queue
+ "A first-in, first-out sequential data-structure.")
+
+(documentation: /.of_list
+ ""
+ [(of_list entries)])
+
+(documentation: /.list
+ ""
+ [(list queue)])
+
+(documentation: /.front
+ "Yields the first value in the queue, if any.")
+
+(documentation: /.member?
+ ""
+ [(member? equivalence queue member)])
+
+(documentation: /.next
+ ""
+ [(next queue)])
+
+(documentation: /.end
+ ""
+ [(end val queue)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Queue
+ ..of_list
+ ..list
+ ..front
+ ..member?
+ ..next
+ ..end
+ ($.default /.empty)
+ ($.default /.size)
+ ($.default /.empty?)
+ ($.default /.equivalence)
+ ($.default /.functor)]
+ [/priority.documentation]))
diff --git a/stdlib/source/documentation/lux/data/collection/queue/priority.lux b/stdlib/source/documentation/lux/data/collection/queue/priority.lux
new file mode 100644
index 000000000..e62869ecd
--- /dev/null
+++ b/stdlib/source/documentation/lux/data/collection/queue/priority.lux
@@ -0,0 +1,41 @@
+(.module:
+ [library
+ [lux (#- list)
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ [syntax (#+ syntax:)]
+ ["." code]
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.member?
+ ""
+ [(member? equivalence queue member)])
+
+(documentation: /.end
+ ""
+ [(end priority value queue)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..member?
+ ..end
+ ($.default /.Priority)
+ ($.default /.max)
+ ($.default /.min)
+ ($.default /.Queue)
+ ($.default /.empty)
+ ($.default /.front)
+ ($.default /.size)
+ ($.default /.next)
+ ($.default /.empty?)]
+ []))
diff --git a/stdlib/source/documentation/lux/data/collection/row.lux b/stdlib/source/documentation/lux/data/collection/row.lux
new file mode 100644
index 000000000..e72e8974e
--- /dev/null
+++ b/stdlib/source/documentation/lux/data/collection/row.lux
@@ -0,0 +1,86 @@
+(.module:
+ [library
+ [lux (#- list)
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ [syntax (#+ syntax:)]
+ ["." code]
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Row
+ "A sequential data-structure with fast random access.")
+
+(documentation: /.suffix
+ ""
+ [(suffix val row)])
+
+(documentation: /.within_bounds?
+ "Determines whether the index is within the bounds of the row."
+ [(within_bounds? row idx)])
+
+(documentation: /.item
+ ""
+ [(item idx row)])
+
+(documentation: /.has
+ ""
+ [(has idx val row)])
+
+(documentation: /.revised
+ ""
+ [(revised idx f row)])
+
+(documentation: /.prefix
+ ""
+ [(prefix row)])
+
+(documentation: /.list
+ ""
+ [(list row)])
+
+(documentation: /.member?
+ ""
+ [(member? equivalence row val)])
+
+(documentation: /.row
+ "Row literals."
+ [(: (Row Nat)
+ (row 12 34 56 78 90))])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Row
+ ..suffix
+ ..within_bounds?
+ ..item
+ ..has
+ ..revised
+ ..prefix
+ ..list
+ ..member?
+ ..row
+ ($.default /.empty)
+ ($.default /.size)
+ ($.default /.index_out_of_bounds)
+ ($.default /.of_list)
+ ($.default /.empty?)
+ ($.default /.equivalence)
+ ($.default /.fold)
+ ($.default /.monoid)
+ ($.default /.functor)
+ ($.default /.apply)
+ ($.default /.monad)
+ ($.default /.reversed)
+ ($.default /.every?)
+ ($.default /.any?)]
+ []))
diff --git a/stdlib/source/documentation/lux/data/collection/sequence.lux b/stdlib/source/documentation/lux/data/collection/sequence.lux
new file mode 100644
index 000000000..64e976155
--- /dev/null
+++ b/stdlib/source/documentation/lux/data/collection/sequence.lux
@@ -0,0 +1,98 @@
+(.module:
+ [library
+ [lux (#- list)
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ [syntax (#+ syntax:)]
+ ["." code]
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Sequence
+ "An infinite sequence of values.")
+
+(documentation: /.iterations
+ "A stateful way of infinitely calculating the values of a sequence."
+ [(iterations step init)])
+
+(documentation: /.repeated
+ "Repeat a value forever."
+ [(repeated x)])
+
+(documentation: /.cycle
+ (format "Go over the elements of a list forever."
+ \n "The list should not be empty.")
+ [(cycle [start next])])
+
+(documentation: /.item
+ ""
+ [(item idx sequence)])
+
+(template [<taker> <dropper>]
+ [(documentation: <taker>
+ ""
+ [(<taker> pred xs)])
+ (documentation: <dropper>
+ ""
+ [(<dropper> pred xs)])]
+
+ [/.while /.until]
+ [/.first /.after]
+ )
+
+(template [<splitter>]
+ [(documentation: <splitter>
+ ""
+ [(<splitter> pred xs)])]
+
+ [/.split_when]
+ [/.split_at]
+ )
+
+(documentation: /.only
+ "A new sequence only with items that satisfy the predicate."
+ [(only predicate sequence)])
+
+(documentation: /.partition
+ (format "Split a sequence in two based on a predicate."
+ \n "The left side contains all entries for which the predicate is #1."
+ \n "The right side contains all entries for which the predicate is #0.")
+ [(partition left? xs)])
+
+(documentation: /.^sequence&
+ (format "Allows destructuring of sequences in pattern-matching expressions."
+ \n "Caveat emptor: Only use it for destructuring, and not for testing values within the sequences.")
+ [(let [(^sequence& x y z _tail) (some_sequence_func +1 +2 +3)]
+ (func x y z))])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Sequence
+ ..iterations
+ ..repeated
+ ..cycle
+ ..item
+
+ ..while ..until
+ ..first ..after
+
+ ..split_when
+ ..split_at
+
+ ..only
+ ..partition
+ ..^sequence&
+ ($.default /.head)
+ ($.default /.tail)
+ ($.default /.functor)
+ ($.default /.comonad)]
+ []))
diff --git a/stdlib/source/documentation/lux/data/color.lux b/stdlib/source/documentation/lux/data/color.lux
new file mode 100644
index 000000000..96a44b6ed
--- /dev/null
+++ b/stdlib/source/documentation/lux/data/color.lux
@@ -0,0 +1,126 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ [syntax (#+ syntax:)]
+ ["." code]
+ ["." template]]]]
+ [\\library
+ ["." /]]
+ ["." / #_
+ ["#." named]])
+
+(documentation: /.RGB
+ "Red-Green-Blue color format.")
+
+(documentation: /.HSL
+ "Hue-Saturation-Lightness color format.")
+
+(documentation: /.CMYK
+ "Cyan-Magenta-Yellow-Key color format.")
+
+(documentation: /.HSB
+ "Hue-Saturation-Brightness color format.")
+
+(documentation: /.Color
+ "A color value, independent of color format.")
+
+(documentation: /.complement
+ "The opposite color."
+ [(complement color)])
+
+(documentation: /.interpolated
+ ""
+ [(interpolated ratio end start)])
+
+(template [<name>]
+ [(documentation: <name>
+ ""
+ [(<name> ratio color)])]
+
+ [/.darker]
+ [/.brighter]
+ [/.saturated]
+ [/.un_saturated]
+ )
+
+(syntax: (palette_documentation [[_ name] <code>.identifier])
+ (in (list (code.text (format "A " (text.replaced "_" "-" name) " palette.")))))
+
+(documentation: /.analogous
+ (palette_documentation /.analogous)
+ [(analogous spread variations color)])
+
+(documentation: /.monochromatic
+ (palette_documentation /.monochromatic)
+ [(monochromatic spread variations color)])
+
+(documentation: /.Alpha
+ "The degree of transparency of a pigment.")
+
+(documentation: /.transparent
+ "The maximum degree of transparency.")
+
+(documentation: /.translucent
+ "The average degree of transparency.")
+
+(documentation: /.opaque
+ "The minimum degree of transparency.")
+
+(documentation: /.Pigment
+ "A color with some degree of transparency.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..RGB
+ ..HSL
+ ..CMYK
+ ..HSB
+ ..Color
+ ..complement
+ ..interpolated
+
+ ..darker
+ ..brighter
+ ..saturated
+ ..un_saturated
+
+ ..analogous
+ ..monochromatic
+ ..Alpha
+ ..transparent
+ ..translucent
+ ..opaque
+ ..Pigment
+ ($.default /.of_rgb)
+ ($.default /.rgb)
+ ($.default /.equivalence)
+ ($.default /.hash)
+ ($.default /.black)
+ ($.default /.white)
+ ($.default /.addition)
+ ($.default /.subtraction)
+ ($.default /.hsl)
+ ($.default /.of_hsl)
+ ($.default /.hsb)
+ ($.default /.of_hsb)
+ ($.default /.cmyk)
+ ($.default /.of_cmyk)
+ ($.default /.gray_scale)
+ ($.default /.triad)
+ ($.default /.clash)
+ ($.default /.split_complement)
+ ($.default /.square)
+ ($.default /.tetradic)
+ ($.default /.Spread)
+ ($.default /.Palette)]
+ [/named.documentation]))
diff --git a/stdlib/source/documentation/lux/data/color/named.lux b/stdlib/source/documentation/lux/data/color/named.lux
new file mode 100644
index 000000000..6f9a080eb
--- /dev/null
+++ b/stdlib/source/documentation/lux/data/color/named.lux
@@ -0,0 +1,319 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ [syntax (#+ syntax:)]
+ ["." code]
+ ["." template]]
+ [math
+ [number
+ ["." nat ("#\." hex)]]]]]
+ [\\library
+ ["." /
+ ["/#" //]]])
+
+(template [<name>]
+ [(documentation: <name>
+ (let [[red green blue] (//.rgb <name>)
+ [_ name] (name_of <name>)]
+ (format "R:" (nat\encode red)
+ " G:" (nat\encode green)
+ " B:" (nat\encode blue)
+ " | " (text.replaced "_" " " name))))]
+
+ [/.alice_blue]
+ [/.antique_white]
+ [/.aqua]
+ [/.aquamarine]
+ [/.azure]
+ [/.beige]
+ [/.bisque]
+ [/.black]
+ [/.blanched_almond]
+ [/.blue]
+ [/.blue_violet]
+ [/.brown]
+ [/.burly_wood]
+ [/.cadet_blue]
+ [/.chartreuse]
+ [/.chocolate]
+ [/.coral]
+ [/.cornflower_blue]
+ [/.cornsilk]
+ [/.crimson]
+ [/.cyan]
+ [/.dark_blue]
+ [/.dark_cyan]
+ [/.dark_goldenrod]
+ [/.dark_gray]
+ [/.dark_green]
+ [/.dark_khaki]
+ [/.dark_magenta]
+ [/.dark_olive_green]
+ [/.dark_orange]
+ [/.dark_orchid]
+ [/.dark_red]
+ [/.dark_salmon]
+ [/.dark_sea_green]
+ [/.dark_slate_blue]
+ [/.dark_slate_gray]
+ [/.dark_turquoise]
+ [/.dark_violet]
+ [/.deep_pink]
+ [/.deep_sky_blue]
+ [/.dim_gray]
+ [/.dodger_blue]
+ [/.fire_brick]
+ [/.floral_white]
+ [/.forest_green]
+ [/.fuchsia]
+ [/.gainsboro]
+ [/.ghost_white]
+ [/.gold]
+ [/.goldenrod]
+ [/.gray]
+ [/.green]
+ [/.green_yellow]
+ [/.honey_dew]
+ [/.hot_pink]
+ [/.indian_red]
+ [/.indigo]
+ [/.ivory]
+ [/.khaki]
+ [/.lavender]
+ [/.lavender_blush]
+ [/.lawn_green]
+ [/.lemon_chiffon]
+ [/.light_blue]
+ [/.light_coral]
+ [/.light_cyan]
+ [/.light_goldenrod_yellow]
+ [/.light_gray]
+ [/.light_green]
+ [/.light_pink]
+ [/.light_salmon]
+ [/.light_sea_green]
+ [/.light_sky_blue]
+ [/.light_slate_gray]
+ [/.light_steel_blue]
+ [/.light_yellow]
+ [/.lime]
+ [/.lime_green]
+ [/.linen]
+ [/.magenta]
+ [/.maroon]
+ [/.medium_aquamarine]
+ [/.medium_blue]
+ [/.medium_orchid]
+ [/.medium_purple]
+ [/.medium_sea_green]
+ [/.medium_slate_blue]
+ [/.medium_spring_green]
+ [/.medium_turquoise]
+ [/.medium_violet_red]
+ [/.midnight_blue]
+ [/.mint_cream]
+ [/.misty_rose]
+ [/.moccasin]
+ [/.navajo_white]
+ [/.navy]
+ [/.old_lace]
+ [/.olive]
+ [/.olive_drab]
+ [/.orange]
+ [/.orange_red]
+ [/.orchid]
+ [/.pale_goldenrod]
+ [/.pale_green]
+ [/.pale_turquoise]
+ [/.pale_violet_red]
+ [/.papaya_whip]
+ [/.peach_puff]
+ [/.peru]
+ [/.pink]
+ [/.plum]
+ [/.powder_blue]
+ [/.purple]
+ [/.rebecca_purple]
+ [/.red]
+ [/.rosy_brown]
+ [/.royal_blue]
+ [/.saddle_brown]
+ [/.salmon]
+ [/.sandy_brown]
+ [/.sea_green]
+ [/.sea_shell]
+ [/.sienna]
+ [/.silver]
+ [/.sky_blue]
+ [/.slate_blue]
+ [/.slate_gray]
+ [/.snow]
+ [/.spring_green]
+ [/.steel_blue]
+ [/.tan]
+ [/.teal]
+ [/.thistle]
+ [/.tomato]
+ [/.turquoise]
+ [/.violet]
+ [/.wheat]
+ [/.white]
+ [/.white_smoke]
+ [/.yellow]
+ [/.yellow_green]
+ )
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..alice_blue
+ ..antique_white
+ ..aqua
+ ..aquamarine
+ ..azure
+ ..beige
+ ..bisque
+ ..black
+ ..blanched_almond
+ ..blue
+ ..blue_violet
+ ..brown
+ ..burly_wood
+ ..cadet_blue
+ ..chartreuse
+ ..chocolate
+ ..coral
+ ..cornflower_blue
+ ..cornsilk
+ ..crimson
+ ..cyan
+ ..dark_blue
+ ..dark_cyan
+ ..dark_goldenrod
+ ..dark_gray
+ ..dark_green
+ ..dark_khaki
+ ..dark_magenta
+ ..dark_olive_green
+ ..dark_orange
+ ..dark_orchid
+ ..dark_red
+ ..dark_salmon
+ ..dark_sea_green
+ ..dark_slate_blue
+ ..dark_slate_gray
+ ..dark_turquoise
+ ..dark_violet
+ ..deep_pink
+ ..deep_sky_blue
+ ..dim_gray
+ ..dodger_blue
+ ..fire_brick
+ ..floral_white
+ ..forest_green
+ ..fuchsia
+ ..gainsboro
+ ..ghost_white
+ ..gold
+ ..goldenrod
+ ..gray
+ ..green
+ ..green_yellow
+ ..honey_dew
+ ..hot_pink
+ ..indian_red
+ ..indigo
+ ..ivory
+ ..khaki
+ ..lavender
+ ..lavender_blush
+ ..lawn_green
+ ..lemon_chiffon
+ ..light_blue
+ ..light_coral
+ ..light_cyan
+ ..light_goldenrod_yellow
+ ..light_gray
+ ..light_green
+ ..light_pink
+ ..light_salmon
+ ..light_sea_green
+ ..light_sky_blue
+ ..light_slate_gray
+ ..light_steel_blue
+ ..light_yellow
+ ..lime
+ ..lime_green
+ ..linen
+ ..magenta
+ ..maroon
+ ..medium_aquamarine
+ ..medium_blue
+ ..medium_orchid
+ ..medium_purple
+ ..medium_sea_green
+ ..medium_slate_blue
+ ..medium_spring_green
+ ..medium_turquoise
+ ..medium_violet_red
+ ..midnight_blue
+ ..mint_cream
+ ..misty_rose
+ ..moccasin
+ ..navajo_white
+ ..navy
+ ..old_lace
+ ..olive
+ ..olive_drab
+ ..orange
+ ..orange_red
+ ..orchid
+ ..pale_goldenrod
+ ..pale_green
+ ..pale_turquoise
+ ..pale_violet_red
+ ..papaya_whip
+ ..peach_puff
+ ..peru
+ ..pink
+ ..plum
+ ..powder_blue
+ ..purple
+ ..rebecca_purple
+ ..red
+ ..rosy_brown
+ ..royal_blue
+ ..saddle_brown
+ ..salmon
+ ..sandy_brown
+ ..sea_green
+ ..sea_shell
+ ..sienna
+ ..silver
+ ..sky_blue
+ ..slate_blue
+ ..slate_gray
+ ..snow
+ ..spring_green
+ ..steel_blue
+ ..tan
+ ..teal
+ ..thistle
+ ..tomato
+ ..turquoise
+ ..violet
+ ..wheat
+ ..white
+ ..white_smoke
+ ..yellow
+ ..yellow_green]
+ []))
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index 6554978c9..6c1335fe9 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -691,33 +691,55 @@
... #seed Nat
... #scope_type_vars (List Nat)
... #extensions Any
+... #eval (-> Type Code (-> Lux (Either Text [Lux Any])))
... #host Any})
("lux def type tagged" Lux
(#Named ["library/lux" "Lux"]
- (#Product ... "lux.info"
- Info
- (#Product ... "lux.source"
- Source
- (#Product ... "lux.location"
- Location
- (#Product ... "lux.current_module"
- (#Apply Text Maybe)
- (#Product ... "lux.modules"
- (#Apply (#Product Text Module) List)
- (#Product ... "lux.scopes"
- (#Apply Scope List)
- (#Product ... "lux.type_context"
- Type_Context
- (#Product ... "lux.expected"
- (#Apply Type Maybe)
- (#Product ... "lux.seed"
- Nat
- (#Product ... scope_type_vars
- (#Apply Nat List)
- (#Product ... extensions
- Any
- ... "lux.host"
- Any))))))))))))
+ ({Lux
+ (#Apply Nothing
+ (#UnivQ #End
+ (#Product
+ ... info
+ Info
+ (#Product
+ ... source
+ Source
+ (#Product
+ ... location
+ Location
+ (#Product
+ ... current_module
+ (#Apply Text Maybe)
+ (#Product
+ ... modules
+ (#Apply (#Product Text Module) List)
+ (#Product
+ ... scopes
+ (#Apply Scope List)
+ (#Product
+ ... type_context
+ Type_Context
+ (#Product
+ ... expected
+ (#Apply Type Maybe)
+ (#Product
+ ... seed
+ Nat
+ (#Product
+ ... scope_type_vars
+ (#Apply Nat List)
+ (#Product
+ ... extensions
+ Any
+ (#Product
+ ... eval
+ (#Function Type
+ (#Function Code
+ (#Function Lux
+ (#Sum Text (#Product Lux Any)))))
+ ... host
+ Any))))))))))))))}
+ (#Apply (#Parameter 1) (#Parameter 0))))
(record$ (#Item [(tag$ ["library/lux" "doc"])
(text$ ("lux text concat"
("lux text concat" "Represents the state of the Lux compiler during a run." __paragraph)
@@ -725,7 +747,7 @@
("lux text concat" "It is provided to macros during their invocation, so they can access compiler data." __paragraph)
"Caveat emptor: Avoid fiddling with it, unless you know what you're doing.")))]
#End))
- ["info" "source" "location" "current_module" "modules" "scopes" "type_context" "expected" "seed" "scope_type_vars" "extensions" "host"]
+ ["info" "source" "location" "current_module" "modules" "scopes" "type_context" "expected" "seed" "scope_type_vars" "extensions" "eval" "host"]
#1)
... (type: .public (Meta a)
@@ -1223,7 +1245,7 @@
(failure "Wrong syntax for Ex")}
tokens)))
-(def:'' .private (list\reverse list)
+(def:'' .private (list\reversed list)
#End
(All [a] (#Function ($' List a) ($' List a)))
(list\fold ("lux type check" (All [a] (#Function a (#Function ($' List a) ($' List a))))
@@ -1248,7 +1270,7 @@
_
(failure "Wrong syntax for ->")}
- (list\reverse tokens)))
+ (list\reversed tokens)))
(macro:' .public (list xs)
(#Item [(tag$ ["library/lux" "doc"])
@@ -1261,7 +1283,7 @@
(#Item (tuple$ (#Item [head (#Item [tail #End])]))
#End))))
(tag$ ["library/lux" "End"])
- (list\reverse xs))
+ (list\reversed xs))
#End)))
(macro:' .public (list& xs)
@@ -1281,7 +1303,7 @@
_
(failure "Wrong syntax for list&")}
- (list\reverse xs)))
+ (list\reversed xs)))
(macro:' .public (Variant tokens)
(#Item [(tag$ ["library/lux" "doc"])
@@ -1300,7 +1322,7 @@
(in_meta (list (list\fold (function'' [left right] (form$ (list (tag$ ["library/lux" "Sum"]) left right)))
last
prevs)))}
- (list\reverse tokens)))
+ (list\reversed tokens)))
(macro:' .public (Tuple tokens)
(#Item [(tag$ ["library/lux" "doc"])
@@ -1319,7 +1341,7 @@
(in_meta (list (list\fold (function'' [left right] (form$ (list (tag$ ["library/lux" "Product"]) left right)))
last
prevs)))}
- (list\reverse tokens)))
+ (list\reversed tokens)))
(macro:' .private (function' tokens)
(let'' [name tokens'] ({(#Item [[_ (#Identifier ["" name])] tokens'])
@@ -1340,7 +1362,7 @@
arg))
body')))
body
- (list\reverse targs))))))}
+ (list\reversed targs))))))}
args)
_
@@ -1412,7 +1434,7 @@
(form$ (list (record$ (list [label body])) value))}
binding)))
body
- (list\reverse (pairs bindings)))))
+ (list\reversed (pairs bindings)))))
_
(failure "Wrong syntax for let'")}
@@ -1512,7 +1534,7 @@
_
(failure "Wrong syntax for $_")}
- (list\reverse tokens'))
+ (list\reversed tokens'))
_
(failure "Wrong syntax for $_")}
@@ -1588,7 +1610,7 @@
value))}
var))))
body
- (list\reverse (pairs bindings)))]
+ (list\reversed (pairs bindings)))]
(in_meta (list (form$ (list (record$ (list [(record$ (list [(tag$ ["library/lux" "in"]) g!in] [(tag$ ["library/lux" "bind"]) g!bind]))
body']))
monad)))))
@@ -1690,7 +1712,7 @@
{#info info #source source #current_module _ #modules modules
#scopes scopes #type_context types #host host
#seed seed #expected expected #location location #extensions extensions
- #scope_type_vars scope_type_vars} state]
+ #scope_type_vars scope_type_vars #eval _eval} state]
({(#Some {#module_hash _ #module_aliases _ #definitions definitions #imports _ #tags tags #types types #module_annotations _ #module_state _})
({(#Some constant)
({(#Left real_name)
@@ -1749,7 +1771,7 @@
leftI))
lastO
inits))}
- (list\reverse elems))
+ (list\reversed elems))
#0
(do meta_monad
[=elems (monad\map meta_monad untemplated elems)]
@@ -1874,7 +1896,7 @@
({{#info info #source source #current_module current_module #modules modules
#scopes scopes #type_context types #host host
#seed seed #expected expected #location location #extensions extensions
- #scope_type_vars scope_type_vars}
+ #scope_type_vars scope_type_vars #eval _eval}
({(#Some module_name)
(#Right [state module_name])
@@ -1979,7 +2001,7 @@
_
(failure "Wrong syntax for <|")}
- (list\reverse tokens)))
+ (list\reversed tokens)))
(def:''' .private (function\composite f g)
(list [(tag$ ["library/lux" "doc"])
@@ -2101,7 +2123,7 @@
#End
(All [a]
(-> ($' List ($' List a)) ($' List a)))
- (list\fold list\compose #End (list\reverse xs)))
+ (list\fold list\compose #End (list\reversed xs)))
(macro:' .public (template tokens)
(list [(tag$ ["library/lux" "doc"])
@@ -2298,7 +2320,7 @@
#scopes scopes #type_context types #host host
#seed seed #expected expected
#location location #extensions extensions
- #scope_type_vars scope_type_vars}
+ #scope_type_vars scope_type_vars #eval _eval}
(#Right state (macro' modules current_module module name))}
state)))))
@@ -2563,12 +2585,12 @@
#scopes scopes #type_context types #host host
#seed seed #expected expected
#location location #extensions extensions
- #scope_type_vars scope_type_vars}
+ #scope_type_vars scope_type_vars #eval _eval}
(#Right {#info info #source source #current_module _ #modules modules
#scopes scopes #type_context types #host host
#seed ("lux i64 +" 1 seed) #expected expected
#location location #extensions extensions
- #scope_type_vars scope_type_vars}
+ #scope_type_vars scope_type_vars #eval _eval}
(local_identifier$ ($_ text\compose "__gensym__" prefix (nat\encode seed))))}
state))
@@ -2607,7 +2629,7 @@
_
(failure "Wrong syntax for exec")}
- (list\reverse tokens)))
+ (list\reversed tokens)))
(macro:' .private (def:' tokens)
(let' [parts (: (Maybe [Code Code (List Code) (Maybe Code) Code])
@@ -2687,14 +2709,14 @@
($_ text\compose "(" (|> xs
(list\map code\encode)
(list\interposed " ")
- list\reverse
+ list\reversed
(list\fold text\compose "")) ")")
[_ (#Tuple xs)]
($_ text\compose "[" (|> xs
(list\map code\encode)
(list\interposed " ")
- list\reverse
+ list\reversed
(list\fold text\compose "")) "]")
[_ (#Record kvs)]
@@ -2702,7 +2724,7 @@
(list\map (function' [kv] ({[k v] ($_ text\compose (code\encode k) " " (code\encode v))}
kv)))
(list\interposed " ")
- list\reverse
+ list\reversed
(list\fold text\compose "")) "}")}
code))
@@ -2735,7 +2757,7 @@
(failure ($_ text\compose "'lux.case' expects an even number of tokens: " (|> branches
(list\map code\encode)
(list\interposed " ")
- list\reverse
+ list\reversed
(list\fold text\compose ""))))}
branches))
@@ -2832,7 +2854,7 @@
(case tokens
(^ (list [_ (#Tuple bindings)] body))
(if (multiple? 2 (list\size bindings))
- (|> bindings pairs list\reverse
+ (|> bindings pairs list\reversed
(list\fold (: (-> [Code Code] Code Code)
(function' [lr body']
(let' [[l r] lr]
@@ -2874,7 +2896,7 @@
(` ([(~ g!name) (~ g!blank)]
(.case (~ g!blank) (~ arg) (~ body'))))))))]
(in_meta (list (nest (..local_identifier$ g!name) head
- (list\fold (nest g!blank) body (list\reverse tail))))))
+ (list\fold (nest g!blank) body (list\reversed tail))))))
#None
(failure "Wrong syntax for function")))
@@ -3261,7 +3283,7 @@
(template [<name> <form> <message> <documentation>]
[(macro: .public (<name> tokens)
{#.doc <documentation>}
- (case (list\reverse tokens)
+ (case (list\reversed tokens)
(^ (list& last init))
(in_meta (list (list\fold (: (-> Code Code Code)
(function (_ pre post) (` <form>)))
@@ -3458,7 +3480,7 @@
(let [{#info info #source source #current_module _ #modules modules
#scopes scopes #type_context types #host host
#seed seed #expected expected #location location #extensions extensions
- #scope_type_vars scope_type_vars} state]
+ #scope_type_vars scope_type_vars #eval _eval} state]
(case (plist\value name modules)
(#Some module)
(#Right state module)
@@ -3515,7 +3537,7 @@
(let [{#info info #source source #current_module _ #modules modules
#scopes scopes #type_context types #host host
#seed seed #expected expected #location location #extensions extensions
- #scope_type_vars scope_type_vars} state]
+ #scope_type_vars scope_type_vars #eval _eval} state]
(case expected
(#Some type)
(#Right state type)
@@ -4032,9 +4054,9 @@
jumps ("lux i64 -" 1 relatives)]
(if (n/< (list\size parts) jumps)
(let [prefix (|> parts
- list\reverse
+ list\reversed
(list\after jumps)
- list\reverse
+ list\reversed
(text\interposed ..module_separator))
clean ("lux text clip" relatives (|> module "lux text size" ("lux i64 -" relatives)) module)
output (case ("lux text size" clean)
@@ -4128,7 +4150,7 @@
{#info info #source source #current_module current_module #modules modules
#scopes scopes #type_context types #host host
#seed seed #expected expected #location location #extensions extensions
- #scope_type_vars scope_type_vars}
+ #scope_type_vars scope_type_vars #eval _eval}
[current_module modules])]
(case (plist\value module modules)
(#Some =module)
@@ -4196,7 +4218,7 @@
{#info info #source source #current_module _ #modules modules
#scopes scopes #type_context types #host host
#seed seed #expected expected #location location #extensions extensions
- #scope_type_vars scope_type_vars}
+ #scope_type_vars scope_type_vars #eval _eval}
(list\one (: (-> Scope (Maybe Type))
(function (_ env)
(case env
@@ -4219,7 +4241,7 @@
{#info info #source source #current_module _ #modules modules
#scopes scopes #type_context types #host host
#seed seed #expected expected #location location #extensions extensions
- #scope_type_vars scope_type_vars} state]
+ #scope_type_vars scope_type_vars #eval _eval} state]
(case (plist\value v_module modules)
#None
#None
@@ -4243,7 +4265,7 @@
{#info info #source source #current_module _ #modules modules
#scopes scopes #type_context types #host host
#seed seed #expected expected #location location #extensions extensions
- #scope_type_vars scope_type_vars} state]
+ #scope_type_vars scope_type_vars #eval _eval} state]
(case (plist\value v_module modules)
#None
(#Left (text\compose "Unknown definition: " (name\encode name)))
@@ -4301,7 +4323,7 @@
(let [{#info _ #source _ #current_module _ #modules _
#scopes _ #type_context type_context #host _
#seed _ #expected _ #location _ #extensions extensions
- #scope_type_vars _} compiler
+ #scope_type_vars _ #eval _eval} compiler
{#ex_counter _ #var_counter _ #var_bindings var_bindings} type_context]
(case (type_variable type_id var_bindings)
#None
@@ -4337,16 +4359,16 @@
name
_
- ($_ text\compose "(" name " " (|> params (list\map type\encode) (list\interposed " ") list\reverse (list\fold text\compose "")) ")"))
+ ($_ text\compose "(" name " " (|> params (list\map type\encode) (list\interposed " ") list\reversed (list\fold text\compose "")) ")"))
(#Sum _)
- ($_ text\compose "(Or " (|> (flat_variant type) (list\map type\encode) (list\interposed " ") list\reverse (list\fold text\compose "")) ")")
+ ($_ text\compose "(Or " (|> (flat_variant type) (list\map type\encode) (list\interposed " ") list\reversed (list\fold text\compose "")) ")")
(#Product _)
- ($_ text\compose "[" (|> (flat_tuple type) (list\map type\encode) (list\interposed " ") list\reverse (list\fold text\compose "")) "]")
+ ($_ text\compose "[" (|> (flat_tuple type) (list\map type\encode) (list\interposed " ") list\reversed (list\fold text\compose "")) "]")
(#Function _)
- ($_ text\compose "(-> " (|> (flat_lambda type) (list\map type\encode) (list\interposed " ") list\reverse (list\fold text\compose "")) ")")
+ ($_ text\compose "(-> " (|> (flat_lambda type) (list\map type\encode) (list\interposed " ") list\reversed (list\fold text\compose "")) ")")
(#Parameter id)
(nat\encode id)
@@ -4367,7 +4389,7 @@
(let [[func args] (flat_application type)]
($_ text\compose
"(" (type\encode func) " "
- (|> args (list\map type\encode) (list\interposed " ") list\reverse (list\fold text\compose ""))
+ (|> args (list\map type\encode) (list\interposed " ") list\reversed (list\fold text\compose ""))
")"))
(#Named name _)
@@ -4435,7 +4457,7 @@
" ''???'')"))}
(if ("lux i64 =" 0 (n/% 2 (list\size tokens)))
(failure "cond requires an uneven number of arguments.")
- (case (list\reverse tokens)
+ (case (list\reversed tokens)
(^ (list& else branches'))
(in_meta (list (list\fold (: (-> [Code Code] Code Code)
(function (_ branch else)
@@ -4834,14 +4856,14 @@
(function (_ [s b] v)
(` (..with@ (~ s) (~ v) (~ b)))))
value
- (list\reverse pairs))
+ (list\reversed pairs))
[_ accesses'] (list\fold (: (-> [Code Code] [Code (List (List Code))] [Code (List (List Code))])
(function (_ [new_slot new_binding] [old_record accesses'])
[(` (value@ (~ new_slot) (~ new_binding)))
(#Item (list new_binding old_record) accesses')]))
[record (: (List (List Code)) #End)]
pairs)
- accesses (list\joined (list\reverse accesses'))]]
+ accesses (list\joined (list\reversed accesses'))]]
(in (list (` (let [(~+ accesses)]
(~ update_expr)))))))
@@ -5525,7 +5547,7 @@
(list)
(list g!_ (` #.None))))))))
(` (#.Some (~ body)))
- (: (List [Code Code]) (list\reverse levels)))]
+ (: (List [Code Code]) (list\reversed levels)))]
(list init_pattern inner_pattern_body)))
(macro: .public (^multi tokens)
@@ -5608,7 +5630,7 @@
{#info info #source source #current_module _ #modules modules
#scopes scopes #type_context types #host host
#seed seed #expected expected #location location #extensions extensions
- #scope_type_vars scope_type_vars}
+ #scope_type_vars scope_type_vars #eval _eval}
(#Right [state scope_type_vars])))
(macro: .public (:parameter tokens)
@@ -5625,7 +5647,7 @@
(^ (list [_ (#Nat idx)]))
(do meta_monad
[stvs ..scope_type_vars]
- (case (..item idx (list\reverse stvs))
+ (case (..item idx (list\reversed stvs))
(#Some var_id)
(in (list (` (#Ex (~ (nat$ var_id))))))
@@ -5999,11 +6021,11 @@
[(def: (<name> g!meta untemplated_pattern elems)
(-> Code (-> Code (Meta Code))
(-> (List Code) (Meta Code)))
- (case (list\reverse elems)
+ (case (list\reversed elems)
(#Item [_ (#Form (#Item [[_ (#Identifier ["" "~+"])] (#Item [spliced #End])]))]
inits)
(do meta_monad
- [=inits (monad\map meta_monad untemplated_pattern (list\reverse inits))]
+ [=inits (monad\map meta_monad untemplated_pattern (list\reversed inits))]
(in (` [(~ g!meta) (<tag> (~ (untemplated_list& spliced =inits)))])))
_
diff --git a/stdlib/source/library/lux/control/parser/json.lux b/stdlib/source/library/lux/control/parser/json.lux
index 65569ff9e..cc954fc1b 100644
--- a/stdlib/source/library/lux/control/parser/json.lux
+++ b/stdlib/source/library/lux/control/parser/json.lux
@@ -23,7 +23,6 @@
["." // ("#\." functor)])
(type: .public (Parser a)
- {#.doc "A JSON parser."}
(//.Parser (List JSON) a))
(exception: .public (unconsumed_input {input (List JSON)})
@@ -33,8 +32,6 @@
(exception: .public empty_input)
(def: .public (result parser json)
- {#.doc (example "Executes the parser against a JSON object."
- "Verifies that all of the JSON was consumed by the parser.")}
(All [a] (-> (Parser a) JSON (Try a)))
(case (//.result parser (list json))
(#try.Success [remainder output])
@@ -49,7 +46,6 @@
(#try.Failure error)))
(def: .public any
- {#.doc "Just returns the JSON input without applying any logic."}
(Parser JSON)
(<| (function (_ inputs))
(case inputs
@@ -63,9 +59,8 @@
(exception.report
["Value" (/.format value)]))
-(template [<name> <type> <tag> <desc>]
+(template [<name> <type> <tag>]
[(def: .public <name>
- {#.doc (code.text ($_ text\compose "Reads a JSON value as " <desc> "."))}
(Parser <type>)
(do //.monad
[head ..any]
@@ -76,10 +71,10 @@
_
(//.failure (exception.error ..unexpected_value [head])))))]
- [null /.Null #/.Null "null"]
- [boolean /.Boolean #/.Boolean "boolean"]
- [number /.Number #/.Number "number"]
- [string /.String #/.String "string"]
+ [null /.Null #/.Null]
+ [boolean /.Boolean #/.Boolean]
+ [number /.Number #/.Number]
+ [string /.String #/.String]
)
(exception: .public [a] (value_mismatch {reference JSON} {sample JSON})
@@ -120,13 +115,11 @@
)
(def: .public (nullable parser)
- {#.doc (example "Enhances parser by adding NULL-handling.")}
(All [a] (-> (Parser a) (Parser (Maybe a))))
(//.or ..null
parser))
(def: .public (array parser)
- {#.doc "Parses the contents of a JSON array."}
(All [a] (-> (Parser a) (Parser a)))
(do //.monad
[head ..any]
@@ -148,8 +141,6 @@
(//.failure (exception.error ..unexpected_value [head])))))
(def: .public (object parser)
- {#.doc (example "Parses the contents of a JSON object."
- "Use this with the 'field' combinator.")}
(All [a] (-> (Parser a) (Parser a)))
(do //.monad
[head ..any]
@@ -176,8 +167,6 @@
(//.failure (exception.error ..unexpected_value [head])))))
(def: .public (field field_name parser)
- {#.doc (example "Parses a field inside a JSON object."
- "Use this inside the 'object' combinator.")}
(All [a] (-> Text (Parser a) (Parser a)))
(function (recur inputs)
(case inputs
@@ -204,7 +193,6 @@
(exception.except ..unconsumed_input inputs))))
(def: .public dictionary
- {#.doc "Parses a dictionary-like JSON object."}
(All [a] (-> (Parser a) (Parser (Dictionary Text a))))
(|>> (//.and ..string)
//.some
diff --git a/stdlib/source/library/lux/control/parser/synthesis.lux b/stdlib/source/library/lux/control/parser/synthesis.lux
index dadf00655..b336a0d58 100644
--- a/stdlib/source/library/lux/control/parser/synthesis.lux
+++ b/stdlib/source/library/lux/control/parser/synthesis.lux
@@ -49,12 +49,9 @@
(exception: .public empty_input)
(type: .public Parser
- {#.doc (example "A parser for the Lux compiler's synthesis nodes using during optimization.")}
(//.Parser (List Synthesis)))
(def: .public (result parser input)
- {#.doc (example "Executes the parser against the inputs."
- "Ensures all inputs are consumed by the parser.")}
(All [a] (-> (Parser a) (List Synthesis) (Try a)))
(case (parser input)
(#try.Failure error)
@@ -67,7 +64,6 @@
(exception.except ..unconsumed_input unconsumed)))
(def: .public any
- {#.doc (example "Yields a synthesis node without subjecting it to any analysis.")}
(Parser Synthesis)
(.function (_ input)
(case input
@@ -78,7 +74,6 @@
(#try.Success [tail head]))))
(def: .public end!
- {#.doc "Ensures there are no more inputs."}
(Parser Any)
(.function (_ tokens)
(case tokens
@@ -86,7 +81,6 @@
_ (exception.except ..expected_empty_input [tokens]))))
(def: .public end?
- {#.doc "Checks whether there are no more inputs."}
(Parser Bit)
(.function (_ tokens)
(#try.Success [tokens (case tokens
@@ -128,7 +122,6 @@
)
(def: .public (tuple parser)
- {#.doc (example "Parses the contents of a tuple.")}
(All [a] (-> (Parser a) (Parser a)))
(.function (_ input)
(case input
@@ -141,7 +134,6 @@
(exception.except ..cannot_parse input))))
(def: .public (function expected parser)
- {#.doc (example "Parses the body of a function with the 'expected' arity.")}
(All [a] (-> Arity (Parser a) (Parser [(Environment Synthesis) a])))
(.function (_ input)
(case input
@@ -156,7 +148,6 @@
(exception.except ..cannot_parse input))))
(def: .public (loop init_parsers iteration_parser)
- {#.doc (example "Parses the initial values and the body of a loop.")}
(All [a b] (-> (Parser a) (Parser b) (Parser [Register a b])))
(.function (_ input)
(case input
diff --git a/stdlib/source/library/lux/control/parser/text.lux b/stdlib/source/library/lux/control/parser/text.lux
index 46ed6e987..b95df4bfd 100644
--- a/stdlib/source/library/lux/control/parser/text.lux
+++ b/stdlib/source/library/lux/control/parser/text.lux
@@ -21,7 +21,6 @@
["." //])
(type: .public Offset
- {#.doc (example "An offset into a block of text.")}
Nat)
(def: start_offset
@@ -29,11 +28,9 @@
0)
(type: .public Parser
- {#.doc (example "A parser for text.")}
(//.Parser [Offset Text]))
(type: .public Slice
- {#.doc (example "A slice of a block of text.")}
{#basis Offset
#distance Offset})
@@ -56,8 +53,6 @@
(exception: .public cannot_slice)
(def: .public (result parser input)
- {#.doc (example "Executes a parser against a block of text."
- "Verifies that the entire input has been processed.")}
(All [a] (-> (Parser a) Text (Try a)))
(case (parser [start_offset input])
(#try.Failure msg)
@@ -69,7 +64,6 @@
(exception.except ..unconsumed_input [end_offset input]))))
(def: .public offset
- {#.doc (example "Yields the current offset into the input.")}
(Parser Offset)
(function (_ (^@ input [offset tape]))
(#try.Success [input offset])))
@@ -87,7 +81,6 @@
slices))))
(def: .public any
- {#.doc "Yields the next character without applying any logic."}
(Parser Text)
(function (_ [offset tape])
(case (/.char offset tape)
@@ -98,7 +91,6 @@
(exception.except ..cannot_parse []))))
(def: .public any!
- {#.doc "Yields the next character (as a slice) without applying any logic."}
(Parser Slice)
(function (_ [offset tape])
(case (/.char offset tape)
@@ -110,9 +102,8 @@
_
(exception.except ..cannot_slice []))))
-(template [<name> <type> <any> <caveat>]
+(template [<name> <type> <any>]
[(`` (def: .public (<name> parser)
- {#.doc (example (~~ (template.text ["Produce a character" <caveat> " if the parser fails."])))}
(All [a] (-> (Parser a) (Parser <type>)))
(function (_ input)
(case (parser input)
@@ -122,8 +113,8 @@
_
(exception.except ..expected_to_fail input)))))]
- [not Text ..any ""]
- [not! Slice ..any! " (as a slice)"]
+ [not Text ..any]
+ [not! Slice ..any!]
)
(exception: .public (cannot_match {reference Text})
@@ -131,7 +122,6 @@
["Reference" (/.format reference)]))
(def: .public (this reference)
- {#.doc (example "Checks that a specific text shows up in the input.")}
(-> Text (Parser Any))
(function (_ [offset tape])
(case (/.index_of' offset reference tape)
@@ -145,7 +135,6 @@
(exception.except ..cannot_match [reference]))))
(def: .public end!
- {#.doc "Ensure the parser's input is empty."}
(Parser Any)
(function (_ (^@ input [offset tape]))
(if (n.= offset (/.size tape))
@@ -153,7 +142,6 @@
(exception.except ..unconsumed_input input))))
(def: .public next
- {#.doc "Yields the next character (without consuming it from the input)."}
(Parser Text)
(function (_ (^@ input [offset tape]))
(case (/.char offset tape)
@@ -164,13 +152,11 @@
(exception.except ..cannot_parse []))))
(def: .public remaining
- {#.doc "Get all of the remaining input (without consuming it)."}
(Parser Text)
(function (_ (^@ input [offset tape]))
(#try.Success [input (remaining' offset tape)])))
(def: .public (range bottom top)
- {#.doc "Only yields characters within a range."}
(-> Nat Nat (Parser Text))
(do //.monad
[char any
@@ -182,7 +168,6 @@
(template [<name> <bottom> <top> <desc>]
[(def: .public <name>
- {#.doc (code.text ($_ /\compose "Only yields " <desc> " characters."))}
(Parser Text)
(..range (char <bottom>) (char <top>)))]
@@ -193,17 +178,14 @@
)
(def: .public alpha
- {#.doc "Yields alphabetic characters."}
(Parser Text)
(//.either lower upper))
(def: .public alpha_num
- {#.doc "Yields alphanumeric characters."}
(Parser Text)
(//.either alpha decimal))
(def: .public hexadecimal
- {#.doc "Yields hexadecimal digits."}
(Parser Text)
($_ //.either
decimal
@@ -265,7 +247,6 @@
["Character" (/.format (/.of_char character))]))
(def: .public (satisfies parser)
- {#.doc "Yields characters that satisfy a predicate."}
(-> (-> Char Bit) (Parser Text))
(function (_ [offset tape])
(case (/.char offset tape)
@@ -278,12 +259,10 @@
(exception.except ..cannot_parse []))))
(def: .public space
- {#.doc "Yields white-space."}
(Parser Text)
(..satisfies /.space?))
(def: .public (and left right)
- {#.doc (example "Yields the outputs of both parsers composed together.")}
(-> (Parser Text) (Parser Text) (Parser Text))
(do //.monad
[=left left
@@ -291,7 +270,6 @@
(in ($_ /\compose =left =right))))
(def: .public (and! left right)
- {#.doc (example "Yields the outputs of both parsers composed together (as a slice).")}
(-> (Parser Slice) (Parser Slice) (Parser Slice))
(do //.monad
[[left::basis left::distance] left
@@ -300,7 +278,6 @@
(template [<name> <base> <doc_modifier>]
[(def: .public (<name> parser)
- {#.doc (code.text ($_ /\compose "Yields " <doc_modifier> " characters as a single continuous text (as a slice)."))}
(-> (Parser Text) (Parser Text))
(|> parser <base> (\ //.monad map /.together)))]
@@ -310,7 +287,6 @@
(template [<name> <base> <doc_modifier>]
[(def: .public (<name> parser)
- {#.doc (code.text ($_ /\compose "Yields " <doc_modifier> " characters as a single continuous text (as a slice)."))}
(-> (Parser Slice) (Parser Slice))
(with_slices (<base> parser)))]
@@ -320,7 +296,6 @@
(template [<name> <base> <doc_modifier>]
[(def: .public (<name> amount parser)
- {#.doc (code.text ($_ /\compose "Yields " <doc_modifier> " N characters (as a slice)."))}
(-> Nat (Parser Text) (Parser Text))
(|> parser
(<base> amount)
@@ -333,7 +308,6 @@
(template [<name> <base> <doc_modifier>]
[(def: .public (<name> amount parser)
- {#.doc (code.text ($_ /\compose "Yields " <doc_modifier> " N characters (as a slice)."))}
(-> Nat (Parser Slice) (Parser Slice))
(with_slices
(<base> amount parser)))]
@@ -361,7 +335,6 @@
(//.after (this start))))
(def: .public (local local_input parser)
- {#.doc "Applies a parser against the given input."}
(All [a] (-> Text (Parser a) (Parser a)))
(function (_ real_input)
(case (..result parser local_input)
@@ -372,7 +345,6 @@
(#try.Success [real_input value]))))
(def: .public (slice parser)
- {#.doc (example "Converts a slice to a block of text.")}
(-> (Parser Slice) (Parser Text))
(do //.monad
[[basis distance] parser]
@@ -385,7 +357,6 @@
(exception.except ..cannot_slice [])))))
(def: .public (then structured text)
- {#.doc (example "Embeds a text parser into an arbitrary parser that yields text.")}
(All [s a]
(-> (Parser a)
(//.Parser s Text)
diff --git a/stdlib/source/library/lux/control/parser/tree.lux b/stdlib/source/library/lux/control/parser/tree.lux
index cba23cf82..1f7a54a1a 100644
--- a/stdlib/source/library/lux/control/parser/tree.lux
+++ b/stdlib/source/library/lux/control/parser/tree.lux
@@ -13,23 +13,19 @@
["." //])
(type: .public (Parser t a)
- {#.doc (example "A parser of arbitrary trees.")}
(//.Parser (Zipper t) a))
(def: .public (result' parser zipper)
- {#.doc (example "Applies the parser against a tree zipper.")}
(All [t a] (-> (Parser t a) (Zipper t) (Try a)))
(do try.monad
[[zipper output] (//.result parser zipper)]
(in output)))
(def: .public (result parser tree)
- {#.doc (example "Applies the parser against a tree.")}
(All [t a] (-> (Parser t a) (Tree t) (Try a)))
(result' parser (zipper.zipper tree)))
(def: .public value
- {#.doc (example "Yields the value inside the current tree node.")}
(All [t] (Parser t t))
(function (_ zipper)
(#try.Success [zipper (zipper.value zipper)])))
diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux
index e6ea2b3dd..029d130fd 100644
--- a/stdlib/source/library/lux/control/parser/type.lux
+++ b/stdlib/source/library/lux/control/parser/type.lux
@@ -1,6 +1,4 @@
(.module:
- {#.doc (.example "Parsing of Lux types."
- "Used mostly for polytypic programming.")}
[library
[lux (#- function local)
[abstract
@@ -61,15 +59,12 @@
(text.interposed ""))]))
(type: .public Env
- {#.doc (example "An environment for type parsing.")}
(Dictionary Nat [Type Code]))
(type: .public (Parser a)
- {#.doc (example "A parser of Lux types.")}
(//.Parser [Env (List Type)] a))
(def: .public fresh
- {#.doc (example "An empty parsing environment.")}
Env
(dictionary.empty n.hash))
@@ -88,13 +83,10 @@
(exception.except ..unconsumed_input remaining))))
(def: .public (result poly type)
- {#.doc (example "Applies a parser against a type."
- "Verifies that the parser fully consumes the type's information.")}
(All [a] (-> (Parser a) Type (Try a)))
(result' ..fresh poly (list type)))
(def: .public env
- {#.doc (example "Yields the current parsing environment.")}
(Parser Env)
(.function (_ [env inputs])
(#try.Success [[env inputs] env])))
@@ -110,7 +102,6 @@
(#try.Success [[env remaining] output]))))
(def: .public next
- {#.doc (example "Inspect a type in the input stream without consuming it.")}
(Parser Type)
(.function (_ [env inputs])
(case inputs
@@ -121,7 +112,6 @@
(#try.Success [[env inputs] headT]))))
(def: .public any
- {#.doc (example "Yields a type, without examination.")}
(Parser Type)
(.function (_ [env inputs])
(case inputs
@@ -132,7 +122,6 @@
(#try.Success [[env tail] headT]))))
(def: .public (local types poly)
- {#.doc (example "Apply a parser to the given inputs.")}
(All [a] (-> (List Type) (Parser a) (Parser a)))
(.function (_ [env pass_through])
(case (result' env poly types)
@@ -222,7 +211,6 @@
(in [funcL all_varsL output])))))
(def: .public (function in_poly out_poly)
- {#.doc (example "Parses a function's inputs and output.")}
(All [i o] (-> (Parser i) (Parser o) (Parser [i o])))
(do //.monad
[headT any
@@ -233,7 +221,6 @@
(//.failure (exception.error ..not_function headT)))))
(def: .public (applied poly)
- {#.doc (example "Parses a type application.")}
(All [a] (-> (Parser a) (Parser a)))
(do //.monad
[headT any
@@ -242,9 +229,8 @@
(//.failure (exception.error ..not_application headT))
(..local (#.Item funcT paramsT) poly))))
-(template [<name> <test> <doc>]
+(template [<name> <test>]
[(def: .public (<name> expected)
- {#.doc (example <doc>)}
(-> Type (Parser Any))
(do //.monad
[actual any]
@@ -252,12 +238,9 @@
(in [])
(//.failure (exception.error ..types_do_not_match [expected actual])))))]
- [exactly type\=
- "Parses a type exactly."]
- [sub check.subsumes?
- "Parses a sub type."]
- [super (function.flipped check.subsumes?)
- "Parses a super type."]
+ [exactly type\=]
+ [sub check.subsumes?]
+ [super (function.flipped check.subsumes?)]
)
(def: .public (adjusted_idx env idx)
@@ -299,7 +282,6 @@
(//.failure (exception.error ..not_parameter headT)))))
(def: .public existential
- {#.doc (example "Yields an existential type.")}
(Parser Nat)
(do //.monad
[headT any]
@@ -311,7 +293,6 @@
(//.failure (exception.error ..not_existential headT)))))
(def: .public named
- {#.doc (example "Yields a named type.")}
(Parser [Name Type])
(do //.monad
[inputT any]
diff --git a/stdlib/source/library/lux/control/parser/xml.lux b/stdlib/source/library/lux/control/parser/xml.lux
index 5785ecba8..2b0332544 100644
--- a/stdlib/source/library/lux/control/parser/xml.lux
+++ b/stdlib/source/library/lux/control/parser/xml.lux
@@ -18,7 +18,6 @@
["." //])
(type: .public (Parser a)
- {#.doc (example "A parser of XML-encoded data.")}
(//.Parser [Attrs (List XML)] a))
(exception: .public empty_input)
@@ -50,13 +49,10 @@
(#try.Failure error)))
(def: .public (result parser documents)
- {#.doc (example "Applies a parser against a stream of XML documents."
- "Verifies that all of the inputs are consumed by the parser.")}
(All [a] (-> (Parser a) (List XML) (Try a)))
(..result' parser /.attributes documents))
(def: .public text
- {#.doc (example "Yields text from a text node.")}
(Parser Text)
(function (_ [attrs documents])
(case documents
@@ -72,7 +68,6 @@
(exception.except ..unexpected_input [])))))
(def: .public tag
- {#.doc (example "Yields the tag from the next node.")}
(Parser Tag)
(function (_ [attrs documents])
(case documents
@@ -88,7 +83,6 @@
(#try.Success [[attrs documents] tag])))))
(def: .public (attribute name)
- {#.doc (example "Yields the value of an attribute in the current node.")}
(-> Attribute (Parser Text))
(function (_ [attrs documents])
(case (dictionary.value name attrs)
@@ -99,7 +93,6 @@
(#try.Success [[attrs documents] value]))))
(def: .public (node expected parser)
- {#.doc (example "Parses the contents of the next node if the tag matches.")}
(All [a] (-> Tag (Parser a) (Parser a)))
(function (_ [attrs documents])
(case documents
@@ -119,7 +112,6 @@
(exception.except ..wrong_tag [expected actual]))))))
(def: .public any
- {#.doc (example "Yields the next node.")}
(Parser XML)
(function (_ [attrs documents])
(case documents
@@ -132,7 +124,6 @@
(exception: .public nowhere)
(def: .public (somewhere parser)
- {#.doc (example "Applies the parser somewhere among the remaining inputs; instead of demanding that the parser succeeds against the immediate inputs.")}
(All [a] (-> (Parser a) (Parser a)))
(function (recur [attrs input])
(case (//.result parser [attrs input])
diff --git a/stdlib/source/library/lux/data/binary.lux b/stdlib/source/library/lux/data/binary.lux
index 13b9b5a9d..6028c1a68 100644
--- a/stdlib/source/library/lux/data/binary.lux
+++ b/stdlib/source/library/lux/data/binary.lux
@@ -33,9 +33,7 @@
["Offset" (%.nat offset)]
["Length" (%.nat length)]))
-(with_expansions [<documentation> (as_is {#.doc (example "A binary BLOB of data.")})
- <jvm> (as_is (type: .public Binary
- <documentation>
+(with_expansions [<jvm> (as_is (type: .public Binary
(ffi.type [byte]))
(ffi.import: java/lang/Object)
@@ -78,17 +76,14 @@
(length ffi.Number)])
(type: .public Binary
- <documentation>
Uint8Array))
@.python
(type: .public Binary
- <documentation>
(primitive "bytearray"))
@.scheme
(as_is (type: .public Binary
- <documentation>
(primitive "bytevector"))
(ffi.import: (make-bytevector [Nat] Binary))
@@ -98,7 +93,6 @@
... Default
(type: .public Binary
- <documentation>
(array.Array (I64 Any)))))
(template: (!size binary)
@@ -171,7 +165,6 @@
(|>> !size))
(def: .public (empty size)
- {#.doc (example "A fresh/empty binary BLOB of the specified size.")}
(-> Nat Binary)
(for {@.old (ffi.array byte size)
@.jvm (ffi.array byte size)
@@ -200,14 +193,12 @@
output))))
(def: .public (read/8! index binary)
- {#.doc (example "Read 1 byte (8 bits) at the given index.")}
(-> Nat Binary (Try I64))
(if (n.< (..!size binary) index)
(#try.Success (!read index binary))
(exception.except ..index_out_of_bounds [(..!size binary) index])))
(def: .public (read/16! index binary)
- {#.doc (example "Read 2 bytes (16 bits) at the given index.")}
(-> Nat Binary (Try I64))
(if (n.< (..!size binary) (n.+ 1 index))
(#try.Success ($_ i64.or
@@ -216,7 +207,6 @@
(exception.except ..index_out_of_bounds [(..!size binary) index])))
(def: .public (read/32! index binary)
- {#.doc (example "Read 4 bytes (32 bits) at the given index.")}
(-> Nat Binary (Try I64))
(if (n.< (..!size binary) (n.+ 3 index))
(#try.Success ($_ i64.or
@@ -227,7 +217,6 @@
(exception.except ..index_out_of_bounds [(..!size binary) index])))
(def: .public (read/64! index binary)
- {#.doc (example "Read 8 bytes (64 bits) at the given index.")}
(-> Nat Binary (Try I64))
(if (n.< (..!size binary) (n.+ 7 index))
(#try.Success ($_ i64.or
@@ -242,7 +231,6 @@
(exception.except ..index_out_of_bounds [(..!size binary) index])))
(def: .public (write/8! index value binary)
- {#.doc (example "Write 1 byte (8 bits) at the given index.")}
(-> Nat (I64 Any) Binary (Try Binary))
(if (n.< (..!size binary) index)
(#try.Success (|> binary
@@ -250,7 +238,6 @@
(exception.except ..index_out_of_bounds [(..!size binary) index])))
(def: .public (write/16! index value binary)
- {#.doc (example "Write 2 bytes (16 bits) at the given index.")}
(-> Nat (I64 Any) Binary (Try Binary))
(if (n.< (..!size binary) (n.+ 1 index))
(#try.Success (|> binary
@@ -259,7 +246,6 @@
(exception.except ..index_out_of_bounds [(..!size binary) index])))
(def: .public (write/32! index value binary)
- {#.doc (example "Write 4 bytes (32 bits) at the given index.")}
(-> Nat (I64 Any) Binary (Try Binary))
(if (n.< (..!size binary) (n.+ 3 index))
(#try.Success (|> binary
@@ -270,7 +256,6 @@
(exception.except ..index_out_of_bounds [(..!size binary) index])))
(def: .public (write/64! index value binary)
- {#.doc (example "Write 8 bytes (64 bits) at the given index.")}
(-> Nat (I64 Any) Binary (Try Binary))
(if (n.< (..!size binary) (n.+ 7 index))
(for {@.scheme (let [write_high (|>> (!write index (i64.right_shifted 56 value))
@@ -323,7 +308,6 @@
["Target output space" (%.nat target_output)])))
(def: .public (copy bytes source_offset source target_offset target)
- {#.doc (example "Mutates the target binary BLOB by copying bytes from the source BLOB to it.")}
(-> Nat Nat Binary Nat Binary (Try Binary))
(with_expansions [<jvm> (as_is (do try.monad
[_ (java/lang/System::arraycopy source (.int source_offset) target (.int target_offset) (.int bytes))]
@@ -345,7 +329,6 @@
(#try.Success target))))))))
(def: .public (slice offset length binary)
- {#.doc (example "Yields a subset of the binary BLOB, so long as the specified range is valid.")}
(-> Nat Nat Binary (Try Binary))
(let [size (..!size binary)
limit (n.+ length offset)]
@@ -359,7 +342,6 @@
(..copy length offset binary 0 (..empty length)))))))
(def: .public (after bytes binary)
- {#.doc (example "Yields a binary BLOB with at most the specified number of bytes removed.")}
(-> Nat Binary Binary)
(case bytes
0 binary
diff --git a/stdlib/source/library/lux/data/bit.lux b/stdlib/source/library/lux/data/bit.lux
index efdca1f5b..6d7b7c9c3 100644
--- a/stdlib/source/library/lux/data/bit.lux
+++ b/stdlib/source/library/lux/data/bit.lux
@@ -61,7 +61,5 @@
_ (#.Left "Wrong syntax for Bit."))))
(def: .public complement
- {#.doc (example "Generates the complement of a predicate."
- "That is a predicate that returns the oposite of the original predicate.")}
(All [a] (-> (-> a Bit) (-> a Bit)))
(function.composite not))
diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux
index ae6aa7b96..c7fe53e3f 100644
--- a/stdlib/source/library/lux/data/collection/array.lux
+++ b/stdlib/source/library/lux/data/collection/array.lux
@@ -22,7 +22,6 @@
"#Array")
(type: .public (Array a)
- {#.doc "Mutable arrays."}
(#.Primitive ..type_name (#.Item a #.End)))
(with_expansions [<index_type> (primitive "java.lang.Long")
@@ -37,7 +36,6 @@
(as_is))
(def: .public (empty size)
- {#.doc (.example "An empty array of the specified size.")}
(All [a] (-> Nat (Array a)))
(for {@.old
(:expected ("jvm anewarray" "(java.lang.Object )" size))
@@ -110,7 +108,6 @@
#.None))
(def: .public (write! index value array)
- {#.doc (.example "Mutate the array by writing a value to the specified index.")}
(All [a]
(-> Nat a (Array a) (Array a)))
(for {@.old
@@ -130,7 +127,6 @@
@.scheme ("scheme array write" index value array)}))
(def: .public (delete! index array)
- {#.doc (.example "Mutate the array by deleting the value at the specified index.")}
(All [a]
(-> Nat (Array a) (Array a)))
(if (n.< (size array) index)
@@ -160,7 +156,6 @@
false))
(def: .public (update! index transform array)
- {#.doc (.example "Mutate the array by updating the value at the specified index.")}
(All [a]
(-> Nat (-> a a) (Array a) (Array a)))
(case (read! index array)
@@ -171,8 +166,6 @@
(write! index (transform value) array)))
(def: .public (upsert! index default transform array)
- {#.doc (.example "Mutate the array by updating the value at the specified index."
- "If there is no value, update and write the default value given.")}
(All [a]
(-> Nat a (-> a a) (Array a) (Array a)))
(write! index
@@ -180,7 +173,6 @@
array))
(def: .public (copy! length src_start src_array dest_start dest_array)
- {#.doc (.example "Writes the contents of one array into the other.")}
(All [a]
(-> Nat Nat (Array a) Nat (Array a)
(Array a)))
@@ -197,7 +189,6 @@
(list.indices length))))
(def: .public (occupancy array)
- {#.doc "Finds out how many cells in an array are occupied."}
(All [a] (-> (Array a) Nat))
(list\fold (function (_ idx count)
(case (read! idx array)
@@ -210,12 +201,10 @@
(list.indices (size array))))
(def: .public (vacancy array)
- {#.doc "Finds out how many cells in an array are vacant."}
(All [a] (-> (Array a) Nat))
(n.- (..occupancy array) (..size array)))
(def: .public (filter! p xs)
- {#.doc (.example "Delete every item of the array that fails to satisfy the predicate.")}
(All [a]
(-> (Predicate a) (Array a) (Array a)))
(list\fold (function (_ idx xs')
@@ -231,7 +220,6 @@
(list.indices (size xs))))
(def: .public (example p xs)
- {#.doc (.example "Yields the first item in the array that satisfies the predicate.")}
(All [a]
(-> (Predicate a) (Array a) (Maybe a)))
(let [arr_size (size xs)]
@@ -248,7 +236,6 @@
#.None))))
(def: .public (example+ p xs)
- {#.doc "Just like 'example', but with access to the index of each value."}
(All [a]
(-> (-> Nat a Bit) (Array a) (Maybe [Nat a])))
(let [arr_size (size xs)]
@@ -265,7 +252,6 @@
#.None))))
(def: .public (clone xs)
- {#.doc (.example "Yields a shallow clone of the array.")}
(All [a] (-> (Array a) (Array a)))
(let [arr_size (size xs)]
(list\fold (function (_ idx ys)
@@ -290,7 +276,6 @@
(-- 0))
(def: .public (list array)
- {#.doc (.example "Yields a list with every non-empty item in the array.")}
(All [a] (-> (Array a) (List a)))
(loop [idx (-- (size array))
output #.End]
@@ -308,7 +293,6 @@
output)))))
(def: .public (list' default array)
- {#.doc (.example "Like 'list', but uses the 'default' value when encountering an empty cell in the array.")}
(All [a] (-> a (Array a) (List a)))
(loop [idx (-- (size array))
output #.End]
diff --git a/stdlib/source/library/lux/data/collection/bits.lux b/stdlib/source/library/lux/data/collection/bits.lux
index b5059ea8a..6c375247c 100644
--- a/stdlib/source/library/lux/data/collection/bits.lux
+++ b/stdlib/source/library/lux/data/collection/bits.lux
@@ -21,7 +21,6 @@
i64.width)
(type: .public Bits
- {#.doc (example "A bit-map.")}
(Array Chunk))
(def: empty_chunk
@@ -33,7 +32,6 @@
(array.empty 0))
(def: .public (size bits)
- {#.doc (example "Measures the size of a bit-map by counting all the 1s in the bit-map.")}
(-> Bits Nat)
(array\fold (function (_ chunk total)
(|> chunk i64.ones (n.+ total)))
diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux
index 6773a3b95..faab0f7b2 100644
--- a/stdlib/source/library/lux/data/collection/dictionary.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary.lux
@@ -556,7 +556,6 @@
colls)))
(type: .public (Dictionary k v)
- {#.doc "A dictionary implemented as a Hash-Array Mapped Trie (HAMT)."}
{#hash (Hash k)
#root (Node k v)})
@@ -565,7 +564,6 @@
(value@ #..hash))
(def: .public (empty key_hash)
- {#.doc (example "An empty dictionary.")}
(All [k v] (-> (Hash k) (Dictionary k v)))
{#hash key_hash
#root empty_node})
@@ -594,14 +592,12 @@
(exception: .public key_already_exists)
(def: .public (has' key val dict)
- {#.doc "Only puts the KV-pair if the key is not already present."}
(All [k v] (-> k v (Dictionary k v) (Try (Dictionary k v))))
(case (value key dict)
#.None (#try.Success (has key val dict))
(#.Some _) (exception.except ..key_already_exists [])))
(def: .public (revised key f dict)
- {#.doc "Transforms the value located at key (if available), using the given function."}
(All [k v] (-> k (-> v v) (Dictionary k v) (Dictionary k v)))
(case (value key dict)
#.None
@@ -611,8 +607,6 @@
(has key (f val) dict)))
(def: .public (revised' key default f dict)
- {#.doc (example "Updates the value at the key; if it exists."
- "Otherwise, puts a value by applying the function to a default.")}
(All [k v] (-> k v (-> v v) (Dictionary k v) (Dictionary k v)))
(..has key
(f (maybe.else default
@@ -651,16 +645,12 @@
)
(def: .public (merged dict2 dict1)
- {#.doc (example "Merges 2 dictionaries."
- "If any collisions with keys occur, the values of dict2 will overwrite those of dict1.")}
(All [k v] (-> (Dictionary k v) (Dictionary k v) (Dictionary k v)))
(list\fold (function (_ [key val] dict) (has key val dict))
dict1
(entries dict2)))
(def: .public (merged_with f dict2 dict1)
- {#.doc (example "Merges 2 dictionaries."
- "If any collisions with keys occur, a new value will be computed by applying 'f' to the values of dict2 and dict1.")}
(All [k v] (-> (-> v v v) (Dictionary k v) (Dictionary k v) (Dictionary k v)))
(list\fold (function (_ [key val2] dict)
(case (value key dict)
@@ -673,7 +663,6 @@
(entries dict2)))
(def: .public (re_bound from_key to_key dict)
- {#.doc (example "If there is a value under 'from_key', remove 'from_key' and store the value under 'to_key'.")}
(All [k v] (-> k k (Dictionary k v) (Dictionary k v)))
(case (value from_key dict)
#.None
@@ -685,7 +674,6 @@
(has to_key val))))
(def: .public (sub keys dict)
- {#.doc "A sub-dictionary, with only the specified keys."}
(All [k v] (-> (List k) (Dictionary k v) (Dictionary k v)))
(let [[key_hash _] dict]
(list\fold (function (_ key new_dict)
diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
index 567c1f457..f19843db9 100644
--- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
@@ -46,12 +46,10 @@
)
(type: .public (Dictionary k v)
- {#.doc (example "A dictionary data-structure with ordered entries.")}
{#&order (Order k)
#root (Maybe (Node k v))})
(def: .public (empty order)
- {#.doc (example "An empty dictionary, employing the given order.")}
(All [k v] (-> (Order k) (Dictionary k v)))
{#&order order
#root #.None})
diff --git a/stdlib/source/library/lux/data/collection/dictionary/plist.lux b/stdlib/source/library/lux/data/collection/dictionary/plist.lux
index c56994d6c..e98a2c51b 100644
--- a/stdlib/source/library/lux/data/collection/dictionary/plist.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary/plist.lux
@@ -14,8 +14,6 @@
... https://en.wikipedia.org/wiki/Property_list
(type: .public (PList a)
- {#.doc (example "A property list."
- "It's a simple dictionary-like structure with Text keys.")}
(List [Text a]))
(def: .public empty
diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux
index cb52d478d..a4bb340e7 100644
--- a/stdlib/source/library/lux/data/collection/list.lux
+++ b/stdlib/source/library/lux/data/collection/list.lux
@@ -51,7 +51,6 @@
xs))
(def: .public (only keep? xs)
- {#.doc (.example "A list with only values that satisfy the predicate.")}
(All [a]
(-> (Predicate a) (List a) (List a)))
(case xs
@@ -64,7 +63,6 @@
(only keep? xs'))))
(def: .public (partition satisfies? list)
- {#.doc "Divide the list into all elements that satisfy a predicate, and all elements that do not."}
(All [a] (-> (Predicate a) (List a) [(List a) (List a)]))
(case list
#.End
@@ -77,8 +75,6 @@
[in (#.Item head out)]))))
(def: .public (pairs xs)
- {#.doc (.example "Cut the list into pairs of 2."
- "Caveat emptor: If the list has an un-even number of elements, the last one will be skipped.")}
(All [a] (-> (List a) (List [a a])))
(case xs
(^ (list& x1 x2 xs'))
@@ -147,14 +143,12 @@
(split_when' predicate (#.Item x ys) xs'))))
(def: .public (split_when predicate xs)
- {#.doc "Segment the list by using a predicate to tell when to cut."}
(All [a]
(-> (Predicate a) (List a) [(List a) (List a)]))
(let [[ys' xs'] (split_when' predicate #.End xs)]
[(reversed ys') xs']))
(def: .public (sub size list)
- {#.doc "Segment the list into sub-lists of (at most) the given size."}
(All [a] (-> Nat (List a) (List (List a))))
(case list
#.End
@@ -165,7 +159,6 @@
(#.Item pre (sub size post)))))
(def: .public (repeated n x)
- {#.doc "A list of the value x, repeated n times."}
(All [a]
(-> Nat a (List a)))
(case n
@@ -183,7 +176,6 @@
(list)))
(def: .public (iterations f x)
- {#.doc "Generates a list element by element until the function returns #.None."}
(All [a]
(-> (-> a (Maybe a)) a (List a)))
(case (f x)
@@ -235,7 +227,6 @@
(all check xs')))))
(def: .public (example predicate xs)
- {#.doc "Yields the first value in the list that satisfies the predicate."}
(All [a]
(-> (Predicate a) (List a) (Maybe a)))
(..one (function (_ value)
@@ -245,7 +236,6 @@
xs))
(def: .public (interposed sep xs)
- {#.doc "Puts a value between every two elements in the list."}
(All [a]
(-> a (List a) (List a)))
(case xs
@@ -279,7 +269,6 @@
)
(def: .public (item i xs)
- {#.doc "Fetches the element at the specified index."}
(All [a]
(-> Nat (List a) (Maybe a)))
(case xs
@@ -371,7 +360,6 @@
(|>> reversed (fold compose identity))))
(def: .public (sorted < xs)
- {#.doc (.example "A list ordered by a comparison function.")}
(All [a] (-> (-> a a Bit) (List a) (List a)))
(case xs
#.End
@@ -421,7 +409,6 @@
)
(def: .public (indices size)
- {#.doc "Produces all the valid indices for a given size."}
(All [a] (-> Nat (List Nat)))
(case size
0 (list)
@@ -454,11 +441,6 @@
_ (recur input' output')))))
(macro: .public (zipped tokens state)
- {#.doc (.example "Create list zippers with the specified number of input lists."
- (def: .public zipped/2 (zipped 2))
- (def: .public zipped/3 (zipped 3))
- (zipped/3 xs ys zs)
- ((zipped 3) xs ys zs))}
(case tokens
(^ (list [_ (#.Nat num_lists)]))
(if (n.> 0 num_lists)
@@ -499,11 +481,6 @@
(def: .public zipped/3 (zipped 3))
(macro: .public (zipped_with tokens state)
- {#.doc (.example "Create list zippers with the specified number of input lists."
- (def: .public zipped_with/2 (zipped_with 2))
- (def: .public zipped_with/3 (zipped_with 3))
- (zipped_with/2 + xs ys)
- ((zipped_with 2) + xs ys))}
(case tokens
(^ (list [_ (#.Nat num_lists)]))
(if (n.> 0 num_lists)
@@ -559,8 +536,6 @@
(last xs')))
(def: .public (inits xs)
- {#.doc (.example "For a list of size N, yields the first N-1 elements."
- "Will yield a #.None for empty lists.")}
(All [a] (-> (List a) (Maybe (List a))))
(case xs
#.End
@@ -579,12 +554,10 @@
))
(def: .public together
- {#.doc (.example "The sequential combination of all the lists.")}
(All [a] (-> (List (List a)) (List a)))
(\ ..monad join))
(implementation: .public (with monad)
- {#.doc (.example "Enhances a monad with List functionality.")}
(All [M] (-> (Monad M) (Monad (All [a] (M (List a))))))
(def: &functor
@@ -605,12 +578,10 @@
(in (..together lla)))))
(def: .public (lifted monad)
- {#.doc (.example "Wraps a monadic value with List machinery.")}
(All [M a] (-> (Monad M) (-> (M a) (M (List a)))))
(\ monad map (\ ..monad in)))
(def: .public (enumeration xs)
- {#.doc "Pairs every element in the list with its index, starting at 0."}
(All [a] (-> (List a) (List [Nat a])))
(loop [idx 0
xs xs]
@@ -622,11 +593,6 @@
(#.Item [idx x] (recur (++ idx) xs')))))
(macro: .public (when tokens state)
- {#.doc (.example "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)))}
(case tokens
(^ (.list test then))
(#.Right [state (.list (` (.if (~ test)
diff --git a/stdlib/source/library/lux/data/collection/queue.lux b/stdlib/source/library/lux/data/collection/queue.lux
index a54543eae..e8caf83f7 100644
--- a/stdlib/source/library/lux/data/collection/queue.lux
+++ b/stdlib/source/library/lux/data/collection/queue.lux
@@ -12,7 +12,6 @@
["n" nat]]]]])
(type: .public (Queue a)
- {#.doc (example "A first-in, first-out sequential data-structure.")}
{#front (List a)
#rear (List a)})
@@ -32,7 +31,6 @@
(list\compose front (list.reversed rear))))
(def: .public front
- {#.doc (example "Yields the first value in the queue, if any.")}
(All [a] (-> (Queue a) (Maybe a)))
(|>> (value@ #front) list.head))
diff --git a/stdlib/source/library/lux/data/collection/row.lux b/stdlib/source/library/lux/data/collection/row.lux
index e77ef1bdf..16929459e 100644
--- a/stdlib/source/library/lux/data/collection/row.lux
+++ b/stdlib/source/library/lux/data/collection/row.lux
@@ -183,7 +183,6 @@
#.End))))
(type: .public (Row a)
- {#.doc (example "A sequential data-structure with fast random access.")}
{#level Level
#size Nat
#root (Hierarchy a)
@@ -242,7 +241,6 @@
(exception: base_was_not_found)
(def: .public (within_bounds? row idx)
- {#.doc (example "Determines whether the index is within the bounds of the row.")}
(All [a] (-> (Row a) Nat Bit))
(n.< (value@ #size row) idx))
@@ -350,17 +348,15 @@
(All [a] (-> (List a) (Row a)))
(list\fold ..suffix ..empty))
-(def: .public (member? a/Equivalence row val)
+(def: .public (member? equivalence row val)
(All [a] (-> (Equivalence a) (Row a) a Bit))
- (list.member? a/Equivalence (list row) val))
+ (list.member? equivalence (list row) val))
(def: .public empty?
(All [a] (-> (Row a) Bit))
(|>> (value@ #size) (n.= 0)))
(syntax: .public (row [elems (<>.some <code>.any)])
- {#.doc (example "Row literals."
- (row 12 34 56 78 90))}
(in (.list (` (..of_list (.list (~+ elems)))))))
(implementation: (node_equivalence Equivalence<a>)
diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux
index 42cd682df..2bed3b721 100644
--- a/stdlib/source/library/lux/data/collection/sequence.lux
+++ b/stdlib/source/library/lux/data/collection/sequence.lux
@@ -20,25 +20,20 @@
["n" nat]]]]])
(type: .public (Sequence a)
- {#.doc "An infinite sequence of values."}
(Cont [a (Sequence a)]))
(def: .public (iterations step init)
- {#.doc "A stateful way of infinitely calculating the values of a sequence."}
(All [a b]
(-> (-> a [a b]) a (Sequence b)))
(let [[next x] (step init)]
(//.pending [x (iterations step next)])))
(def: .public (repeated x)
- {#.doc "Repeat a value forever."}
(All [a]
(-> a (Sequence a)))
(//.pending [x (repeated x)]))
(def: .public (cycle [start next])
- {#.doc (example "Go over the elements of a list forever."
- "The list should not be empty.")}
(All [a]
(-> [a (List a)] (Sequence a)))
(loop [head start
@@ -103,7 +98,6 @@
)
(def: .public (only predicate sequence)
- {#.doc (example "A new sequence only with items that satisfy the predicate.")}
(All [a] (-> (-> a Bit) (Sequence a) (Sequence a)))
(let [[head tail] (//.result sequence)]
(if (predicate head)
@@ -111,9 +105,6 @@
(only predicate tail))))
(def: .public (partition left? xs)
- {#.doc (example "Split a sequence in two based on a predicate."
- "The left side contains all entries for which the predicate is #1."
- "The right side contains all entries for which the predicate is #0.")}
(All [a] (-> (-> a Bit) (Sequence a) [(Sequence a) (Sequence a)]))
[(..only left? xs)
(..only (bit.complement left?) xs)])
@@ -139,10 +130,6 @@
(syntax: .public (^sequence& [patterns (<code>.form (<>.many <code>.any))
body <code>.any
branches (<>.some <code>.any)])
- {#.doc (example "Allows destructuring of sequences in pattern-matching expressions."
- "Caveat emptor: Only use it for destructuring, and not for testing values within the sequences."
- (let [(^sequence& x y z _tail) (some_sequence_func +1 +2 +3)]
- (func x y z)))}
(with_identifiers [g!sequence]
(let [body+ (` (let [(~+ (list\join (list\map (function (_ pattern)
(list (` [(~ pattern) (~ g!sequence)])
diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux
index 1cebc0408..d34918cf2 100644
--- a/stdlib/source/library/lux/data/color.lux
+++ b/stdlib/source/library/lux/data/color.lux
@@ -42,29 +42,25 @@
(|>> (f.* rgb_factor) f.int .nat))
(type: .public RGB
- {#.doc (example "Red-Green-Blue color format.")}
{#red Nat
#green Nat
#blue Nat})
(type: .public HSL
- {#.doc (example "Hue-Saturation-Lightness color format.")}
[Frac Frac Frac])
(type: .public CMYK
- {#.doc (example "Cyan-Magenta-Yellow-Key color format.")}
{#cyan Frac
#magenta Frac
#yellow Frac
#key Frac})
(type: .public HSB
- {#.doc (example "Hue-Saturation-Brightness color format.")}
[Frac Frac Frac])
(abstract: .public Color
- {#.doc (example "A color value, independent of color format.")}
-
+ {}
+
RGB
(def: .public (of_rgb [red green blue])
@@ -128,7 +124,6 @@
(|> ..top (n.- value)))
(def: .public (complement color)
- {#.doc (example "The opposite color.")}
(-> Color Color)
(let [[red green blue] (:representation color)]
(:abstraction {#red (complement' red)
@@ -409,13 +404,7 @@
(type: .public Palette
(-> Spread Nat Color (List Color)))
-(syntax: (palette_documentation [name <code>.local_identifier])
- (let [name (text.replaced "_" "-" name)
- g!documentation (code.text (format "A " name " palette."))]
- (in (list (` {#.doc (.example (~ g!documentation))})))))
-
(`` (def: .public (analogous spread variations color)
- (~~ (..palette_documentation analogous))
Palette
(let [[hue saturation brightness] (hsb color)
spread (..normal spread)]
@@ -426,7 +415,6 @@
(list.indices variations)))))
(`` (def: .public (monochromatic spread variations color)
- (~~ (..palette_documentation monochromatic))
Palette
(let [[hue saturation brightness] (hsb color)
spread (..normal spread)]
@@ -439,25 +427,20 @@
of_hsb))))))
(type: .public Alpha
- {#.doc (example "The degree of transparency of a pigment.")}
Rev)
(def: .public transparent
- {#.doc (example "The maximum degree of transparency.")}
Alpha
rev\bottom)
(def: .public translucent
- {#.doc (example "The average degree of transparency.")}
Alpha
.5)
(def: .public opaque
- {#.doc (example "The minimum degree of transparency.")}
Alpha
rev\top)
(type: .public Pigment
- {#.doc (example "A color with some degree of transparency.")}
{#color Color
#alpha Alpha})
diff --git a/stdlib/source/library/lux/data/color/named.lux b/stdlib/source/library/lux/data/color/named.lux
index f94dacd1a..5e5e5bc65 100644
--- a/stdlib/source/library/lux/data/color/named.lux
+++ b/stdlib/source/library/lux/data/color/named.lux
@@ -1,30 +1,10 @@
(.module:
[library
[lux #*
- [control
- ["<>" parser
- ["<.>" code]]]
- [data
- ["." text
- ["%" format (#+ format)]]]
- [macro
- ["." syntax (#+ syntax:)]
- ["." code]]
[math
[number (#+ hex)]]]]
["." // (#+ Color)])
-(syntax: (documentation [<red> <code>.text
- <green> <code>.text
- <blue> <code>.text
- <name> <code>.local_identifier])
- (|> <name>
- (text.replaced "_" " ")
- (format <red> <green> <blue> " | ")
- code.text
- list
- in))
-
(template [<red> <green> <blue> <name>]
[(`` (def: .public <name>
{#.doc (example (~~ (..documentation <red> <green> <blue> <name>)))}
diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux
index d7f3c9544..bc91e8880 100644
--- a/stdlib/source/library/lux/ffi.jvm.lux
+++ b/stdlib/source/library/lux/ffi.jvm.lux
@@ -392,21 +392,21 @@
(-> (Type Declaration) Code)
(|>> ..signature code.text))
-(def: (make_get_const_parser class_name field_name)
+(def: (get_const_parser class_name field_name)
(-> Text Text (Parser Code))
(do <>.monad
[.let [dotted_name (format "::" field_name)]
_ (<code>.this! (code.identifier ["" dotted_name]))]
(in (get_static_field class_name field_name))))
-(def: (make_get_var_parser class_name field_name self_name)
+(def: (get_var_parser class_name field_name self_name)
(-> Text Text Text (Parser Code))
(do <>.monad
[.let [dotted_name (format "::" field_name)]
_ (<code>.this! (code.identifier ["" dotted_name]))]
(in (get_virtual_field class_name field_name (code.local_identifier self_name)))))
-(def: (make_put_var_parser class_name field_name self_name)
+(def: (put_var_parser class_name field_name self_name)
(-> Text Text Text (Parser Code))
(do <>.monad
[.let [dotted_name (format "::" field_name)]
@@ -450,17 +450,17 @@
(-> Text Text [Member_Declaration FieldDecl] (Parser Code))
(case field
(#ConstantField _)
- (make_get_const_parser class_name field_name)
+ (get_const_parser class_name field_name)
(#VariableField _)
- (<>.either (make_get_var_parser class_name field_name self_name)
- (make_put_var_parser class_name field_name self_name))))
+ (<>.either (get_var_parser class_name field_name self_name)
+ (put_var_parser class_name field_name self_name))))
(def: (decorate_input [class value])
(-> [(Type Value) Code] Code)
(` [(~ (code.text (..signature class))) (~ value)]))
-(def: (make_constructor_parser class_name arguments)
+(def: (constructor_parser class_name arguments)
(-> Text (List Argument) (Parser Code))
(do <>.monad
[args (: (Parser (List Code))
@@ -471,7 +471,7 @@
(list.zipped/2 (list\map product.right arguments))
(list\map ..decorate_input))))))))
-(def: (make_static_method_parser class_name method_name arguments)
+(def: (static_method_parser class_name method_name arguments)
(-> Text Text (List Argument) (Parser Code))
(do <>.monad
[.let [dotted_name (format "::" method_name "!")]
@@ -497,30 +497,30 @@
(list.zipped/2 (list\map product.right arguments))
(list\map ..decorate_input))))))))]
- [make_special_method_parser "jvm member invoke special"]
- [make_virtual_method_parser "jvm member invoke virtual"]
+ [special_method_parser "jvm member invoke special"]
+ [virtual_method_parser "jvm member invoke virtual"]
)
(def: (method->parser class_name [[method_name _ _] meth_def])
(-> Text [Member_Declaration Method_Definition] (Parser Code))
(case meth_def
(#ConstructorMethod strict? type_vars self_name args constructor_args return_expr exs)
- (make_constructor_parser class_name args)
+ (constructor_parser class_name args)
(#StaticMethod strict? type_vars args return_type return_expr exs)
- (make_static_method_parser class_name method_name args)
+ (static_method_parser class_name method_name args)
(#VirtualMethod final? strict? type_vars self_name args return_type return_expr exs)
- (make_virtual_method_parser class_name method_name args self_name)
+ (virtual_method_parser class_name method_name args self_name)
(#OverridenMethod strict? owner_class type_vars self_name args return_type return_expr exs)
- (make_special_method_parser class_name method_name args self_name)
+ (special_method_parser class_name method_name args self_name)
(#AbstractMethod type_vars args return_type exs)
- (make_virtual_method_parser class_name method_name args "")
+ (virtual_method_parser class_name method_name args "")
(#NativeMethod type_vars args return_type exs)
- (make_virtual_method_parser class_name method_name args "")))
+ (virtual_method_parser class_name method_name args "")))
(def: privacy_modifier^
(Parser Privacy)
diff --git a/stdlib/source/library/lux/macro/syntax/definition.lux b/stdlib/source/library/lux/macro/syntax/definition.lux
index 14e907870..79fde60e7 100644
--- a/stdlib/source/library/lux/macro/syntax/definition.lux
+++ b/stdlib/source/library/lux/macro/syntax/definition.lux
@@ -124,7 +124,7 @@
<code>.bit
))))
-(exception: .public (lacks_type! {definition Definition})
+(exception: .public (lacks_type {definition Definition})
(exception.report
["Definition" (%.code (..format definition))]))
@@ -138,5 +138,5 @@
(in [])
(#.Right _)
- (<>.lifted (exception.except ..lacks_type! [definition])))]
+ (<>.lifted (exception.except ..lacks_type [definition])))]
(in definition)))
diff --git a/stdlib/source/library/lux/math/number/rev.lux b/stdlib/source/library/lux/math/number/rev.lux
index 3fc60202c..c7d5641ce 100644
--- a/stdlib/source/library/lux/math/number/rev.lux
+++ b/stdlib/source/library/lux/math/number/rev.lux
@@ -25,6 +25,7 @@
Rev
(.rev (//i64.left_shifted (//nat.- <power> //i64.width) 1)))]
+ [00 /1]
[01 /2]
[02 /4]
[03 /8]
diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux
index 7b6e893d3..0b4b809fc 100644
--- a/stdlib/source/library/lux/meta.lux
+++ b/stdlib/source/library/lux/meta.lux
@@ -599,3 +599,10 @@
(#try.Failure error)
(..failure error)))
+
+(def: .public (eval type code)
+ (-> Type Code (Meta Any))
+ (do {! ..monad}
+ [eval (\ ! map (value@ #.eval)
+ ..compiler_state)]
+ (eval type code)))
diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux
index 29af87345..e92cd49e4 100644
--- a/stdlib/source/library/lux/test.lux
+++ b/stdlib/source/library/lux/test.lux
@@ -310,7 +310,7 @@
Text
(text.of_char 31))
-(def: encode_coverage
+(def: encoded_coverage
(-> (List Text) Text)
(list\fold (function (_ short aggregate)
(case aggregate
@@ -318,7 +318,7 @@
_ (format aggregate ..coverage_separator short)))
""))
-(def: (decode_coverage module encoding)
+(def: (coverage module encoding)
(-> Text Text (Set Name))
(loop [remaining encoding
output (set.of_list name.hash (list))]
@@ -366,7 +366,7 @@
(def: (covering' module coverage test)
(-> Text Text Test Test)
- (let [coverage (..decode_coverage module coverage)]
+ (let [coverage (..coverage module coverage)]
(|> (..context module test)
(random\map (async\map (function (_ [tally documentation])
[(revised@ #expected_coverage (set.union coverage) tally)
@@ -388,7 +388,7 @@
(#.Item short aggregate)
aggregate))
#.End)
- ..encode_coverage)]]
+ ..encoded_coverage)]]
(in (list (` ((~! ..covering')
(~ (code.text module))
(~ (code.text coverage))
diff --git a/stdlib/source/library/lux/tool/compiler/default/init.lux b/stdlib/source/library/lux/tool/compiler/default/init.lux
index 04971dadd..c01a1f6c1 100644
--- a/stdlib/source/library/lux/tool/compiler/default/init.lux
+++ b/stdlib/source/library/lux/tool/compiler/default/init.lux
@@ -169,9 +169,9 @@
(in [buffer registry])))
... TODO: Inline ASAP
-(def: (process_directive archive expander pre_payoad code)
+(def: (process_directive wrapper archive expander pre_payoad code)
(All [directive]
- (-> Archive Expander (Payload directive) Code
+ (-> ///phase.Wrapper Archive Expander (Payload directive) Code
(All [anchor expression]
(///directive.Operation anchor expression directive
[Requirements (Payload directive)]))))
@@ -181,26 +181,26 @@
(///generation.set_buffer pre_buffer))
_ (///directive.lifted_generation
(///generation.set_registry pre_registry))
- requirements (let [execute! (directiveP.phase expander)]
+ requirements (let [execute! (directiveP.phase wrapper expander)]
(execute! archive code))
post_payload (..get_current_payload pre_payoad)]
(in [requirements post_payload])))
-(def: (iteration' archive expander reader source pre_payload)
+(def: (iteration' wrapper archive expander reader source pre_payload)
(All [directive]
- (-> Archive Expander Reader Source (Payload directive)
+ (-> ///phase.Wrapper Archive Expander Reader Source (Payload directive)
(All [anchor expression]
(///directive.Operation anchor expression directive
[Source Requirements (Payload directive)]))))
(do ///phase.monad
[[source code] (///directive.lifted_analysis
(..read source reader))
- [requirements post_payload] (process_directive archive expander pre_payload code)]
+ [requirements post_payload] (process_directive wrapper archive expander pre_payload code)]
(in [source requirements post_payload])))
-(def: (iteration archive expander module source pre_payload aliases)
+(def: (iteration wrapper archive expander module source pre_payload aliases)
(All [directive]
- (-> Archive Expander Module Source (Payload directive) Aliases
+ (-> ///phase.Wrapper Archive Expander Module Source (Payload directive) Aliases
(All [anchor expression]
(///directive.Operation anchor expression directive
(Maybe [Source Requirements (Payload directive)])))))
@@ -208,7 +208,7 @@
[reader (///directive.lifted_analysis
(..reader module aliases source))]
(function (_ state)
- (case (///phase.result' state (..iteration' archive expander reader source pre_payload))
+ (case (///phase.result' state (..iteration' wrapper archive expander reader source pre_payload))
(#try.Success [state source&requirements&buffer])
(#try.Success [state (#.Some source&requirements&buffer)])
@@ -228,11 +228,11 @@
(-> .Module Aliases)
(|>> (value@ #.module_aliases) (dictionary.of_list text.hash)))
-(def: .public (compiler expander prelude write_directive)
+(def: .public (compiler wrapper expander prelude write_directive)
(All [anchor expression directive]
- (-> Expander Module (-> directive Binary)
+ (-> ///phase.Wrapper Expander Module (-> directive Binary)
(Instancer (///directive.State+ anchor expression directive) .Module)))
- (let [execute! (directiveP.phase expander)]
+ (let [execute! (directiveP.phase wrapper expander)]
(function (_ key parameters input)
(let [dependencies (default_dependencies prelude input)]
{#///.dependencies dependencies
@@ -243,7 +243,7 @@
(..begin dependencies hash input))
.let [module (value@ #///.module input)]]
(loop [iteration (<| (///phase.result' state)
- (..iteration archive expander module source buffer ///syntax.no_aliases))]
+ (..iteration wrapper archive expander module source buffer ///syntax.no_aliases))]
(do !
[[state ?source&requirements&temporary_payload] iteration]
(case ?source&requirements&temporary_payload
@@ -284,5 +284,5 @@
(value@ #///directive.referrals)
(monad.map ! (execute! archive)))
temporary_payload (..get_current_payload temporary_payload)]
- (..iteration archive expander module source temporary_payload (..module_aliases analysis_module))))))})]))
+ (..iteration wrapper archive expander module source temporary_payload (..module_aliases analysis_module))))))})]))
)))))}))))
diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux
index 1ac28821f..b5eed68f8 100644
--- a/stdlib/source/library/lux/tool/compiler/default/platform.lux
+++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux
@@ -64,15 +64,12 @@
(with_expansions [<type_vars> (as_is anchor expression directive)
<Operation> (as_is ///generation.Operation <type_vars>)]
- (type: .public Phase_Wrapper
- (All [s i o] (-> (Phase s i o) Any)))
-
(type: .public (Platform <type_vars>)
{#&file_system (file.System Async)
#host (///generation.Host expression directive)
#phase (///generation.Phase <type_vars>)
#runtime (<Operation> [Registry Output])
- #phase_wrapper (-> Archive (<Operation> Phase_Wrapper))
+ #phase_wrapper (-> Archive (<Operation> ///phase.Wrapper))
#write (-> directive Binary)})
... TODO: Get rid of this
@@ -197,7 +194,7 @@
(def: (phase_wrapper archive platform state)
(All [<type_vars>]
- (-> Archive <Platform> <State+> (Try [<State+> Phase_Wrapper])))
+ (-> Archive <Platform> <State+> (Try [<State+> ///phase.Wrapper])))
(let [phase_wrapper (value@ #phase_wrapper platform)]
(|> archive
phase_wrapper
@@ -206,8 +203,8 @@
(def: (complete_extensions host_directive_bundle phase_wrapper [analysers synthesizers generators directives])
(All [<type_vars>]
- (-> (-> Phase_Wrapper (///directive.Bundle <type_vars>))
- Phase_Wrapper
+ (-> (-> ///phase.Wrapper (///directive.Bundle <type_vars>))
+ ///phase.Wrapper
[(Dictionary Text ///analysis.Handler)
(Dictionary Text ///synthesis.Handler)
(Dictionary Text (///generation.Handler <type_vars>))
@@ -230,11 +227,11 @@
///analysis.Bundle
<Platform>
<Bundle>
- (-> Phase_Wrapper (///directive.Bundle <type_vars>))
+ (-> ///phase.Wrapper (///directive.Bundle <type_vars>))
(Program expression directive)
- [Type Type Type] (-> Phase_Wrapper Extender)
+ [Type Type Type] (-> ///phase.Wrapper Extender)
Import (List Context)
- (Async (Try [<State+> Archive]))))
+ (Async (Try [<State+> Archive ///phase.Wrapper]))))
(do {! (try.with async.monad)}
[.let [state (//init.state (value@ #static.host static)
module
@@ -247,7 +244,8 @@
[archive analysis_state bundles] (ioW.thaw (value@ #host platform) (value@ #&file_system platform) static import compilation_sources)
.let [with_missing_extensions
(: (All [<type_vars>]
- (-> <Platform> (Program expression directive) <State+> (Async (Try <State+>))))
+ (-> <Platform> (Program expression directive) <State+>
+ (Async (Try [///phase.Wrapper <State+>]))))
(function (_ platform program state)
(async\in
(do try.monad
@@ -256,19 +254,20 @@
(initialize_state (extender phase_wrapper)
(:expected (..complete_extensions host_directive_bundle phase_wrapper (:expected bundles)))
analysis_state)
- (try\map (//init.with_default_directives expander host_analysis program anchorT,expressionT,directiveT (extender phase_wrapper))))))))]]
+ (try\map (|>> (//init.with_default_directives expander host_analysis program anchorT,expressionT,directiveT (extender phase_wrapper))
+ [phase_wrapper])))))))]]
(if (archive.archived? archive archive.runtime_module)
(do !
- [state (with_missing_extensions platform program state)]
- (in [state archive]))
+ [[phase_wrapper state] (with_missing_extensions platform program state)]
+ (in [state archive phase_wrapper]))
(do !
[[state [archive payload]] (|> (..process_runtime archive platform)
(///phase.result' state)
async\in)
_ (..cache_module static platform 0 payload)
- state (with_missing_extensions platform program state)]
- (in [state archive])))))
+ [phase_wrapper state] (with_missing_extensions platform program state)]
+ (in [state archive phase_wrapper])))))
(def: compilation_log_separator
(format text.new_line text.tab))
@@ -523,9 +522,9 @@
try.trusted
product.left))
- (def: .public (compile import static expander platform compilation context)
+ (def: .public (compile phase_wrapper import static expander platform compilation context)
(All [<type_vars>]
- (-> Import Static Expander <Platform> Compilation <Context> <Return>))
+ (-> ///phase.Wrapper Import Static Expander <Platform> Compilation <Context> <Return>))
(let [[compilation_sources compilation_host_dependencies compilation_libraries compilation_target compilation_module] compilation
base_compiler (:sharing [<type_vars>]
<Context>
@@ -533,7 +532,7 @@
(///.Compiler <State+> .Module Any)
(:expected
- ((//init.compiler expander syntax.prelude (value@ #write platform)) $.key (list))))
+ ((//init.compiler phase_wrapper expander syntax.prelude (value@ #write platform)) $.key (list))))
compiler (..parallel
context
(function (_ importer import! module_id [archive state] module)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
index aefd908c4..45216a70f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
@@ -553,4 +553,5 @@
#.seed 0
#.scope_type_vars (list)
#.extensions []
+ #.eval (:as (-> Type Code (Meta Any)) [])
#.host []})
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/evaluation.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/evaluation.lux
index 1859802d6..8bba841e2 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/evaluation.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/evaluation.lux
@@ -27,7 +27,7 @@
[descriptor (#+ Module)]]]]]]]])
(type: .public Eval
- (-> Archive Nat Type Code (Operation Any)))
+ (-> Archive Type Code (Operation Any)))
(def: (context [module_id artifact_id])
(-> Context Context)
@@ -42,12 +42,14 @@
(generation.Phase anchor expression artifact)
Eval))
(let [analyze (analysisP.phase expander)]
- (function (eval archive count type exprC)
+ (function (eval archive type exprC)
(do phase.monad
[exprA (type.with_type type
(analyze archive exprC))
module (extensionP.lifted
- meta.current_module_name)]
+ meta.current_module_name)
+ count (extensionP.lifted
+ meta.seed)]
(phase.lifted (do try.monad
[exprS (|> exprA (synthesisP.phase archive) (phase.result synthesis_state))]
(phase.result generation_state
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux
index ee12a8bf0..c8cfe9c0e 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux
@@ -124,10 +124,10 @@
(compile archive expansion))
_
- (/function.on compile argsC+ functionT functionA archive functionC)))
+ (/function.apply compile argsC+ functionT functionA archive functionC)))
_
- (/function.on compile argsC+ functionT functionA archive functionC)))
+ (/function.apply compile argsC+ functionT functionA archive functionC)))
_
(//.except ..unrecognized_syntax [location.dummy code'])))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux
index b3642f5f3..fc7575260 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux
@@ -84,7 +84,7 @@
(#.Var id)
(do ///.monad
[?caseT' (//type.with_env
- (check.read id))]
+ (check.read' id))]
(.case ?caseT'
(#.Some caseT')
(recur envs caseT')
@@ -110,7 +110,7 @@
(do ///.monad
[funcT' (//type.with_env
(do check.monad
- [?funct' (check.read funcT_id)]
+ [?funct' (check.read' funcT_id)]
(.case ?funct'
(#.Some funct')
(in funct')
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux
index 69e75f374..8aa2f284f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux
@@ -71,7 +71,7 @@
(#.Var id)
(do !
[?expectedT' (//type.with_env
- (check.read id))]
+ (check.read' id))]
(case ?expectedT'
(#.Some expectedT')
(recur expectedT')
@@ -85,8 +85,7 @@
functionA (recur functionT)
_ (//type.with_env
(check.check expectedT functionT))]
- (in functionA))
- ))
+ (in functionA))))
(#.Function inputT outputT)
(<| (\ ! map (.function (_ [scope bodyA])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux
index 0420b7811..452bf6bc1 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux
@@ -166,7 +166,8 @@
(#.Var infer_id)
(do ///.monad
- [?inferT' (//type.with_env (check.read infer_id))]
+ [?inferT' (//type.with_env
+ (check.read' infer_id))]
(case ?inferT'
(#.Some inferT')
(general archive analyse inferT' args)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux
index fe296c83e..886ffe065 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux
@@ -119,7 +119,7 @@
(#.Var id)
(do !
[?expectedT' (//type.with_env
- (check.read id))]
+ (check.read' id))]
(case ?expectedT'
(#.Some expectedT')
(//type.with_type expectedT'
@@ -144,7 +144,8 @@
(case funT
(#.Var funT_id)
(do !
- [?funT' (//type.with_env (check.read funT_id))]
+ [?funT' (//type.with_env
+ (check.read' funT_id))]
(case ?funT'
(#.Some funT')
(//type.with_type (#.Apply inputT funT')
@@ -208,7 +209,7 @@
(#.Var id)
(do !
[?expectedT' (//type.with_env
- (check.read id))]
+ (check.read' id))]
(case ?expectedT'
(#.Some expectedT')
(//type.with_type expectedT'
@@ -237,7 +238,8 @@
(case funT
(#.Var funT_id)
(do !
- [?funT' (//type.with_env (check.read funT_id))]
+ [?funT' (//type.with_env
+ (check.read' funT_id))]
(case ?funT'
(#.Some funT')
(//type.with_type (#.Apply inputT funT')
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux
index cc34e04cf..3c6425da3 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux
@@ -1,16 +1,17 @@
(.module:
[library
[lux #*
+ ["." meta]
[abstract
["." monad (#+ do)]]
[control
+ ["." try]
["." exception (#+ exception:)]]
[data
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." fold monoid)]]]
- ["." meta]]]
+ ["." list ("#\." fold monoid)]]]]]
["." // #_
["#." extension]
["#." analysis
@@ -18,11 +19,14 @@
["/#" // #_
["/" directive (#+ Phase)]
["#." analysis
+ ["." evaluation]
["#/." macro (#+ Expander)]]
[///
["//" phase]
[reference (#+)
- [variable (#+)]]]]])
+ [variable (#+)]]
+ [meta
+ [archive (#+ Archive)]]]]])
(exception: .public (not_a_directive {code Code})
(exception.report
@@ -36,44 +40,68 @@
(exception.report
["Name" (%.name name)]))
+(type: Eval
+ (-> Type Code (Meta Any)))
+
+(def: (meta_eval archive bundle compiler_eval)
+ (-> Archive ///analysis.Bundle evaluation.Eval
+ Eval)
+ (function (_ type code lux)
+ (case (compiler_eval archive type code [bundle lux])
+ (#try.Success [[_bundle lux'] value])
+ (#try.Success [lux' value])
+
+ (#try.Failure error)
+ (#try.Failure error))))
+
(with_expansions [<lux_def_module> (as_is [|form_location| (#.Form (list& [|text_location| (#.Text "lux def module")] annotations))])]
- (def: .public (phase expander)
- (-> Expander Phase)
- (let [analyze (//analysis.phase expander)]
+ (def: .public (phase wrapper expander)
+ (-> //.Wrapper Expander Phase)
+ (let [analysis (//analysis.phase expander)]
(function (recur archive code)
- (case code
- (^ [_ (#.Form (list& [_ (#.Text name)] inputs))])
- (//extension.apply archive recur [name inputs])
+ (do {! //.monad}
+ [state //.get_state
+ .let [compiler_eval (meta_eval archive
+ (value@ [#//extension.state #/.analysis #/.state #//extension.bundle] state)
+ (evaluation.evaluator expander
+ (value@ [#//extension.state #/.synthesis #/.state] state)
+ (value@ [#//extension.state #/.generation #/.state] state)
+ (value@ [#//extension.state #/.generation #/.phase] state)))
+ extension_eval (:as Eval (wrapper (:expected compiler_eval)))]
+ _ (//.set_state (with@ [#//extension.state #/.analysis #/.state #//extension.state #.eval] extension_eval state))]
+ (case code
+ (^ [_ (#.Form (list& [_ (#.Text name)] inputs))])
+ (//extension.apply archive recur [name inputs])
- (^ [_ (#.Form (list& macro inputs))])
- (do {! //.monad}
- [expansion (/.lifted_analysis
- (do !
- [macroA (//analysis/type.with_type Macro
- (analyze archive macro))]
- (case macroA
- (^ (///analysis.constant macro_name))
- (do !
- [?macro (//extension.lifted (meta.macro macro_name))
- macro (case ?macro
- (#.Some macro)
- (in macro)
-
- #.None
- (//.except ..macro_was_not_found macro_name))]
- (//extension.lifted (///analysis/macro.expand expander macro_name macro inputs)))
-
- _
- (//.except ..invalid_macro_call code))))]
- (case expansion
- (^ (list& <lux_def_module> referrals))
- (|> (recur archive <lux_def_module>)
- (\ ! map (revised@ #/.referrals (list\compose referrals))))
+ (^ [_ (#.Form (list& macro inputs))])
+ (do !
+ [expansion (/.lifted_analysis
+ (do !
+ [macroA (//analysis/type.with_type Macro
+ (analysis archive macro))]
+ (case macroA
+ (^ (///analysis.constant macro_name))
+ (do !
+ [?macro (//extension.lifted (meta.macro macro_name))
+ macro (case ?macro
+ (#.Some macro)
+ (in macro)
+
+ #.None
+ (//.except ..macro_was_not_found macro_name))]
+ (//extension.lifted (///analysis/macro.expand expander macro_name macro inputs)))
+
+ _
+ (//.except ..invalid_macro_call code))))]
+ (case expansion
+ (^ (list& <lux_def_module> referrals))
+ (|> (recur archive <lux_def_module>)
+ (\ ! map (revised@ #/.referrals (list\compose referrals))))
- _
- (|> expansion
- (monad.map ! (recur archive))
- (\ ! map (list\fold /.merge_requirements /.no_requirements)))))
+ _
+ (|> expansion
+ (monad.map ! (recur archive))
+ (\ ! map (list\fold /.merge_requirements /.no_requirements)))))
- _
- (//.except ..not_a_directive code))))))
+ _
+ (//.except ..not_a_directive code)))))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux
index d26820e9a..e56a48572 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux
@@ -164,9 +164,8 @@
(case args
(^ (list typeC valueC))
(do {! ////.monad}
- [seed (///.lifted meta.seed)
- actualT (\ ! map (|>> (:as Type))
- (eval archive seed Type typeC))
+ [actualT (\ ! map (|>> (:as Type))
+ (eval archive Type typeC))
_ (typeA.infer actualT)]
(typeA.with_type actualT
(analyse archive valueC)))
@@ -180,9 +179,8 @@
(case args
(^ (list typeC valueC))
(do {! ////.monad}
- [seed (///.lifted meta.seed)
- actualT (\ ! map (|>> (:as Type))
- (eval archive seed Type typeC))
+ [actualT (\ ! map (|>> (:as Type))
+ (eval archive Type typeC))
_ (typeA.infer actualT)
[valueT valueA] (typeA.with_inference
(analyse archive valueC))]
@@ -240,7 +238,8 @@
(///bundle.install "error" (unary Text Nothing))
(///bundle.install "exit" (unary Int Nothing)))))
-(def: I64* (type (I64 Any)))
+(def: I64*
+ (type (I64 Any)))
(def: bundle::i64
Bundle
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux
index 1e7ca8cc3..f26b13ade 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux
@@ -34,7 +34,7 @@
(def: arity_arguments
(-> Arity (List Synthesis))
- (|>> dec
+ (|>> --
(enum.range n.enum 1)
(list\map (|>> /.variable/local))))
diff --git a/stdlib/source/library/lux/tool/compiler/phase.lux b/stdlib/source/library/lux/tool/compiler/phase.lux
index 92680654d..7e137387e 100644
--- a/stdlib/source/library/lux/tool/compiler/phase.lux
+++ b/stdlib/source/library/lux/tool/compiler/phase.lux
@@ -34,6 +34,9 @@
(type: .public (Phase s i o)
(-> Archive i (Operation s o)))
+(type: .public Wrapper
+ (All [s i o] (-> (Phase s i o) Any)))
+
(def: .public (result' state operation)
(All [s o]
(-> s (Operation s o) (Try [s o])))
diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux
index 7f0e29903..184914216 100644
--- a/stdlib/source/program/compositor.lux
+++ b/stdlib/source/program/compositor.lux
@@ -121,10 +121,10 @@
analysis.Bundle
(IO (Platform <parameters>))
(generation.Bundle <parameters>)
- (-> platform.Phase_Wrapper (directive.Bundle <parameters>))
+ (-> phase.Wrapper (directive.Bundle <parameters>))
(Program expression artifact)
[Type Type Type]
- (-> platform.Phase_Wrapper Extender)
+ (-> phase.Wrapper Extender)
Service
[Packager file.Path]
(Async Any)))
@@ -137,20 +137,21 @@
(do (try.with async.monad)
[.let [[compilation_sources compilation_host_dependencies compilation_libraries compilation_target compilation_module] compilation]
import (/import.import (value@ #platform.&file_system platform) compilation_libraries)
- [state archive] (:sharing [<parameters>]
- (Platform <parameters>)
- platform
-
- (Async (Try [(directive.State+ <parameters>)
- Archive]))
- (:expected (platform.initialize static compilation_module expander host_analysis platform generation_bundle host_directive_bundle program anchorT,expressionT,directiveT extender
- import compilation_sources)))
+ [state archive phase_wrapper] (:sharing [<parameters>]
+ (Platform <parameters>)
+ platform
+
+ (Async (Try [(directive.State+ <parameters>)
+ Archive
+ phase.Wrapper]))
+ (:expected (platform.initialize static compilation_module expander host_analysis platform generation_bundle host_directive_bundle program anchorT,expressionT,directiveT extender
+ import compilation_sources)))
[archive state] (:sharing [<parameters>]
(Platform <parameters>)
platform
(Async (Try [Archive (directive.State+ <parameters>)]))
- (:expected (platform.compile import static expander platform compilation [archive state])))
+ (:expected (platform.compile phase_wrapper import static expander platform compilation [archive state])))
_ (ioW.freeze (value@ #platform.&file_system platform) static archive)
program_context (async\in ($/program.context archive))
host_dependencies (..load_host_dependencies (value@ #platform.&file_system platform) compilation_host_dependencies)
diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux
index 93f2f8530..a335aa996 100644
--- a/stdlib/source/test/lux/macro.lux
+++ b/stdlib/source/test/lux/macro.lux
@@ -103,6 +103,7 @@
#.seed seed
#.scope_type_vars (list)
#.extensions []
+ #.eval (:as (-> Type Code (Meta Any)) [])
#.host []}])))
(def: expander
diff --git a/stdlib/source/test/lux/macro/syntax/definition.lux b/stdlib/source/test/lux/macro/syntax/definition.lux
index 11074fbc7..e76d65a7b 100644
--- a/stdlib/source/test/lux/macro/syntax/definition.lux
+++ b/stdlib/source/test/lux/macro/syntax/definition.lux
@@ -51,6 +51,7 @@
#.seed 0
#.scope_type_vars (list)
#.extensions []
+ #.eval (:as (-> Type Code (Meta Any)) [])
#.host []})
(def: .public test
@@ -84,12 +85,12 @@
(#try.Success actual)
(\ /.equivalence = expected actual))))
- (_.cover [/.lacks_type!]
+ (_.cover [/.lacks_type]
(let [expected (with@ #/.value (#.Right untyped_value) expected)]
(case (<code>.result (/.typed compiler)
(list (/.format expected)))
(#try.Failure error)
- (exception.match? /.lacks_type! error)
+ (exception.match? /.lacks_type error)
(#try.Success actual)
false)))
diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux
index a56457c9c..742523a67 100644
--- a/stdlib/source/test/lux/meta.lux
+++ b/stdlib/source/test/lux/meta.lux
@@ -65,6 +65,7 @@
#.seed expected_seed
#.scope_type_vars (list)
#.extensions []
+ #.eval (:as (-> Type Code (Meta Any)) [])
#.host []}]]
($_ _.and
(_.cover [/.result]
@@ -112,6 +113,7 @@
#.seed expected_seed
#.scope_type_vars (list)
#.extensions []
+ #.eval (:as (-> Type Code (Meta Any)) [])
#.host []}]]
($_ _.and
(_.cover [/.failure]
@@ -212,6 +214,7 @@
#.seed expected_seed
#.scope_type_vars (list)
#.extensions []
+ #.eval (:as (-> Type Code (Meta Any)) [])
#.host []}]]
(<| (_.for [.Module])
($_ _.and
@@ -310,6 +313,7 @@
#.seed expected_seed
#.scope_type_vars (list)
#.extensions []
+ #.eval (:as (-> Type Code (Meta Any)) [])
#.host []}]]
($_ _.and
(_.cover [/.seed]
@@ -401,6 +405,7 @@
#.seed 0
#.scope_type_vars (list)
#.extensions []
+ #.eval (:as (-> Type Code (Meta Any)) [])
#.host []}])))]]
($_ _.and
(_.cover [.Global .Alias /.globals]
@@ -522,6 +527,7 @@
#.seed 0
#.scope_type_vars (list)
#.extensions []
+ #.eval (:as (-> Type Code (Meta Any)) [])
#.host []}])))]]
($_ _.and
(_.cover [/.export]
@@ -703,6 +709,7 @@
#.seed 0
#.scope_type_vars (list)
#.extensions []
+ #.eval (:as (-> Type Code (Meta Any)) [])
#.host []})]]
($_ _.and
(_.cover [/.tag_lists]
@@ -812,6 +819,7 @@
#.seed 0
#.scope_type_vars (list)
#.extensions []
+ #.eval (:as (-> Type Code (Meta Any)) [])
#.host []})]]
($_ _.and
(_.cover [.Scope /.locals]
@@ -918,6 +926,7 @@
#.seed expected_seed
#.scope_type_vars (list)
#.extensions []
+ #.eval (:as (-> Type Code (Meta Any)) [])
#.host []}]]
($_ _.and
(_.for [/.functor]