aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/meta
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/documentation/lux/meta')
-rw-r--r--stdlib/source/documentation/lux/meta/code.lux10
-rw-r--r--stdlib/source/documentation/lux/meta/compiler/language/lux/analysis.lux4
-rw-r--r--stdlib/source/documentation/lux/meta/compiler/language/lux/synthesis.lux8
-rw-r--r--stdlib/source/documentation/lux/meta/extension.lux20
-rw-r--r--stdlib/source/documentation/lux/meta/location.lux4
-rw-r--r--stdlib/source/documentation/lux/meta/macro.lux78
-rw-r--r--stdlib/source/documentation/lux/meta/macro/local.lux2
-rw-r--r--stdlib/source/documentation/lux/meta/macro/syntax.lux26
-rw-r--r--stdlib/source/documentation/lux/meta/macro/syntax/declaration.lux7
-rw-r--r--stdlib/source/documentation/lux/meta/macro/syntax/definition.lux4
-rw-r--r--stdlib/source/documentation/lux/meta/macro/syntax/export.lux4
-rw-r--r--stdlib/source/documentation/lux/meta/macro/template.lux57
-rw-r--r--stdlib/source/documentation/lux/meta/static.lux20
-rw-r--r--stdlib/source/documentation/lux/meta/type.lux100
-rw-r--r--stdlib/source/documentation/lux/meta/type/check.lux16
-rw-r--r--stdlib/source/documentation/lux/meta/type/dynamic.lux8
-rw-r--r--stdlib/source/documentation/lux/meta/type/implicit.lux38
-rw-r--r--stdlib/source/documentation/lux/meta/type/poly.lux2
-rw-r--r--stdlib/source/documentation/lux/meta/type/primitive.lux157
-rw-r--r--stdlib/source/documentation/lux/meta/type/quotient.lux17
-rw-r--r--stdlib/source/documentation/lux/meta/type/refinement.lux25
-rw-r--r--stdlib/source/documentation/lux/meta/type/resource.lux36
-rw-r--r--stdlib/source/documentation/lux/meta/type/unit.lux6
23 files changed, 329 insertions, 320 deletions
diff --git a/stdlib/source/documentation/lux/meta/code.lux b/stdlib/source/documentation/lux/meta/code.lux
index 65e083e02..7ecef2b60 100644
--- a/stdlib/source/documentation/lux/meta/code.lux
+++ b/stdlib/source/documentation/lux/meta/code.lux
@@ -42,7 +42,7 @@
($.definition \\parser.this
"Ensures the given Code is the next input."
- [(this code)])
+ ($.example (this code)))
(,, (with_template [<query> <check> <desc>]
[($.definition <query>
@@ -70,15 +70,15 @@
($.definition \\parser.result
"Executes a parser against a stream of code, and verifies all the inputs are consumed."
- [(result parser inputs)])
+ ($.example (result parser inputs)))
($.definition \\parser.locally
"Runs parser against the given list of inputs."
- [(locally inputs parser)])
+ ($.example (locally inputs parser)))
($.definition \\parser.not
"Yields the next Code token if the parser fails."
- [(not expected_to_fail)])
+ ($.example (not expected_to_fail)))
($.definition \\parser.next
"Yields the next Code token without consuming it from the input stream.")
@@ -108,7 +108,7 @@
($.definition /.replaced
""
- [(replaced original substitute ast)])
+ ($.example (replaced original substitute ast)))
..\\parser
))
diff --git a/stdlib/source/documentation/lux/meta/compiler/language/lux/analysis.lux b/stdlib/source/documentation/lux/meta/compiler/language/lux/analysis.lux
index bb478f3e9..dc6f198f8 100644
--- a/stdlib/source/documentation/lux/meta/compiler/language/lux/analysis.lux
+++ b/stdlib/source/documentation/lux/meta/compiler/language/lux/analysis.lux
@@ -27,7 +27,7 @@
($.definition \\parser.result
"Executes a parser and makes sure no inputs go unconsumed."
- [(result parser input)])
+ ($.example (result parser input)))
($.definition \\parser.any
"Matches any value, without discrimination.")
@@ -57,7 +57,7 @@
($.definition \\parser.tuple
"Parses only within the context of a tuple's contents."
- [(tuple parser)])
+ ($.example (tuple parser)))
)))
(def .public documentation
diff --git a/stdlib/source/documentation/lux/meta/compiler/language/lux/synthesis.lux b/stdlib/source/documentation/lux/meta/compiler/language/lux/synthesis.lux
index 1ecf3f88b..12e3a24e2 100644
--- a/stdlib/source/documentation/lux/meta/compiler/language/lux/synthesis.lux
+++ b/stdlib/source/documentation/lux/meta/compiler/language/lux/synthesis.lux
@@ -31,7 +31,7 @@
($.definition \\parser.result
(format "Executes the parser against the inputs."
\n "Ensures all inputs are consumed by the parser.")
- [(result parser input)])
+ ($.example (result parser input)))
($.definition \\parser.any
"Yields a synthesis node without subjecting it to any analysis.")
@@ -59,15 +59,15 @@
($.definition \\parser.tuple
"Parses the contents of a tuple."
- [(tuple parser)])
+ ($.example (tuple parser)))
($.definition \\parser.function
"Parses the body of a function with the 'expected' arity."
- [(function expected parser)])
+ ($.example (function expected parser)))
($.definition \\parser.loop
"Parses the initial values and the body of a loop."
- [(loop init_parsers iteration_parser)])
+ ($.example (loop init_parsers iteration_parser)))
)))
(def all_templates
diff --git a/stdlib/source/documentation/lux/meta/extension.lux b/stdlib/source/documentation/lux/meta/extension.lux
index e0ce6b4b0..f27a7c7a0 100644
--- a/stdlib/source/documentation/lux/meta/extension.lux
+++ b/stdlib/source/documentation/lux/meta/extension.lux
@@ -29,23 +29,23 @@
($.definition /.analysis
"Mechanism for defining extensions to Lux's analysis/type-checking infrastructure."
- [(analysis ("my analysis" self phase archive [pass_through <code>.any])
- (phase archive pass_through))])
+ ($.example (analysis ("my analysis" self phase archive [pass_through <code>.any])
+ (phase archive pass_through))))
($.definition /.synthesis
"Mechanism for defining extensions to Lux's synthesis/optimization infrastructure."
- [(synthesis ("my synthesis" self phase archive [pass_through <analysis>.any])
- (phase archive pass_through))])
+ ($.example (synthesis ("my synthesis" self phase archive [pass_through <analysis>.any])
+ (phase archive pass_through))))
($.definition /.generation
""
- [(generation ("my generation" self phase archive [pass_through <synthesis>.any])
- (phase archive pass_through))])
+ ($.example (generation ("my generation" self phase archive [pass_through <synthesis>.any])
+ (phase archive pass_through))))
($.definition /.declaration
""
- [(declaration ("my declaration" self phase archive [parameters (<>.some <code>.any)])
- (do phase.monad
- [.let [_ (debug.log! (format "Successfully installed declaration " (%.text self) "!"))]]
- (in declaration.no_requirements)))])
+ ($.example (declaration ("my declaration" self phase archive [parameters (<>.some <code>.any)])
+ (do phase.monad
+ [.let [_ (debug.log! (format "Successfully installed declaration " (%.text self) "!"))]]
+ (in declaration.no_requirements)))))
))
diff --git a/stdlib/source/documentation/lux/meta/location.lux b/stdlib/source/documentation/lux/meta/location.lux
index e7e7ef30a..28493faf6 100644
--- a/stdlib/source/documentation/lux/meta/location.lux
+++ b/stdlib/source/documentation/lux/meta/location.lux
@@ -19,9 +19,9 @@
($.definition /.here
"The Location of the current form."
- [(here)])
+ ($.example (here)))
($.definition /.with
""
- [(with location error)])
+ ($.example (with location error)))
))
diff --git a/stdlib/source/documentation/lux/meta/macro.lux b/stdlib/source/documentation/lux/meta/macro.lux
index bde4fd2f4..648fa6a6b 100644
--- a/stdlib/source/documentation/lux/meta/macro.lux
+++ b/stdlib/source/documentation/lux/meta/macro.lux
@@ -22,79 +22,81 @@
... ($.definition /.single_expansion
... (format "Given code that requires applying a macro, does it once and returns the result."
... \n "Otherwise, returns the code as-is.")
- ... [(single_expansion syntax)])
+ ... ($.example (single_expansion syntax)))
... ($.definition /.expansion
... (format "Given code that requires applying a macro, expands repeatedly until no more direct macro-calls are left."
... \n "Otherwise, returns the code as-is.")
- ... [(expansion syntax)])
+ ... ($.example (expansion syntax)))
... ($.definition /.full_expansion
... "Expands all macro-calls everywhere recursively, until only primitive/base code remains."
- ... [(full_expansion syntax)])
+ ... ($.example (full_expansion syntax)))
($.definition /.symbol
(format "Generates a unique name as a Code node (ready to be used in code templates)."
\n "A prefix can be given (or just be empty text) to better identify the code for debugging purposes.")
- [(symbol prefix)])
+ ($.example (symbol prefix)))
($.definition /.wrong_syntax_error
"A generic error message for macro syntax failures.")
($.definition /.with_symbols
"Creates new symbols and offers them to the body expression."
- [(def synchronized
- (syntax (_ [lock any
- body any])
- (with_symbols [g!lock g!body g!_]
- (in (list (` (let [(, g!lock) (, lock)
- (, g!_) ("jvm monitorenter" (, g!lock))
- (, g!body) (, body)
- (, g!_) ("jvm monitorexit" (, g!lock))]
- (, g!body))))))))])
+ ($.example (def synchronized
+ (syntax (_ [lock any
+ body any])
+ (with_symbols [g!lock g!body g!_]
+ (in (list (` (let [(, g!lock) (, lock)
+ (, g!_) ("jvm monitorenter" (, g!lock))
+ (, g!body) (, body)
+ (, g!_) ("jvm monitorexit" (, g!lock))]
+ (, g!body))))))))))
... ($.definition /.one_expansion
... "Works just like expand, except that it ensures that the output is a single Code token."
- ... [(one_expansion token)])
+ ... ($.example (one_expansion token)))
... ($.definition /.log_single_expansion!
... (format "Performs a macro-expansion and logs the resulting code."
... \n "You can either use the resulting code, or omit them."
... \n "By omitting them, this macro produces nothing (just like the lux.comment macro).")
- ... [(log_single_expansion!
- ... (def (foo bar baz)
- ... (-> Int Int Int)
- ... (int.+ bar baz)))
- ... (log_single_expansion! "omit"
- ... (def (foo bar baz)
- ... (-> Int Int Int)
- ... (int.+ bar baz)))])
+ ... ($.example (log_single_expansion!
+ ... (def (foo bar baz)
+ ... (-> Int Int Int)
+ ... (int.+ bar baz))))
+ ... ($.example (log_single_expansion! "omit"
+ ... (def (foo bar baz)
+ ... (-> Int Int Int)
+ ... (int.+ bar baz)))))
... ($.definition /.log_expansion!
... (format "Performs a macro-expansion and logs the resulting code."
... \n "You can either use the resulting code, or omit them."
... \n "By omitting them, this macro produces nothing (just like the lux.comment macro).")
- ... [(log_expansion!
- ... (def (foo bar baz)
- ... (-> Int Int Int)
- ... (int.+ bar baz)))
- ... (log_expansion! "omit"
- ... (def (foo bar baz)
- ... (-> Int Int Int)
- ... (int.+ bar baz)))])
+
+ ... ($.example (log_expansion!
+ ... (def (foo bar baz)
+ ... (-> Int Int Int)
+ ... (int.+ bar baz))))
+ ... ($.example (log_expansion! "omit"
+ ... (def (foo bar baz)
+ ... (-> Int Int Int)
+ ... (int.+ bar baz)))))
... ($.definition /.log_full_expansion!
... (format "Performs a macro-expansion and logs the resulting code."
... \n "You can either use the resulting code, or omit them."
... \n "By omitting them, this macro produces nothing (just like the lux.comment macro).")
- ... [(log_full_expansion!
- ... (def (foo bar baz)
- ... (-> Int Int Int)
- ... (int.+ bar baz)))
- ... (log_full_expansion! "omit"
- ... (def (foo bar baz)
- ... (-> Int Int Int)
- ... (int.+ bar baz)))])
+
+ ... ($.example (log_full_expansion!
+ ... (def (foo bar baz)
+ ... (-> Int Int Int)
+ ... (int.+ bar baz))))
+ ... ($.example (log_full_expansion! "omit"
+ ... (def (foo bar baz)
+ ... (-> Int Int Int)
+ ... (int.+ bar baz)))))
(all list#composite
/local.documentation
diff --git a/stdlib/source/documentation/lux/meta/macro/local.lux b/stdlib/source/documentation/lux/meta/macro/local.lux
index 47248b372..36821e6d9 100644
--- a/stdlib/source/documentation/lux/meta/macro/local.lux
+++ b/stdlib/source/documentation/lux/meta/macro/local.lux
@@ -24,5 +24,5 @@
\n "Yields code that can be placed either as expression or as declarations."
\n "This code un-installs the macros."
\n "NOTE: Always use this code once to clean-up..")
- [(push macros)])
+ ($.example (push macros)))
))
diff --git a/stdlib/source/documentation/lux/meta/macro/syntax.lux b/stdlib/source/documentation/lux/meta/macro/syntax.lux
index 4f924ea38..4b9710faa 100644
--- a/stdlib/source/documentation/lux/meta/macro/syntax.lux
+++ b/stdlib/source/documentation/lux/meta/macro/syntax.lux
@@ -28,19 +28,19 @@
\n "The inputs to the macro can be parsed in complex ways through the use of syntax parsers."
\n "The macro body is also (implicitly) run in the Meta monad, to save some typing."
\n "Also, the compiler state can be accessed through a special binding.")
- [(def .public object
- (syntax (_ lux_state [.let [imports (class_imports lux_state)]
- .let [class_vars (list)]
- super (opt (super_class_decl^ imports class_vars))
- interfaces (tuple (some (super_class_decl^ imports class_vars)))
- constructor_args (constructor_args^ imports class_vars)
- methods (some (overriden_method_def^ imports))])
- (let [def_code (all text#composite "anon-class:"
- (spaced (list (super_class_decl$ (maybe.else object_super_class super))
- (with_brackets (spaced (list#each super_class_decl$ interfaces)))
- (with_brackets (spaced (list#each constructor_arg$ constructor_args)))
- (with_brackets (spaced (list#each (method_def$ id) methods))))))]
- (in (list (` ((, (code.text def_code)))))))))])
+ ($.example (def .public object
+ (syntax (_ lux_state [.let [imports (class_imports lux_state)]
+ .let [class_vars (list)]
+ super (opt (super_class_decl^ imports class_vars))
+ interfaces (tuple (some (super_class_decl^ imports class_vars)))
+ constructor_args (constructor_args^ imports class_vars)
+ methods (some (overriden_method_def^ imports))])
+ (let [def_code (all text#composite "anon-class:"
+ (spaced (list (super_class_decl$ (maybe.else object_super_class super))
+ (with_brackets (spaced (list#each super_class_decl$ interfaces)))
+ (with_brackets (spaced (list#each constructor_arg$ constructor_args)))
+ (with_brackets (spaced (list#each (method_def$ id) methods))))))]
+ (in (list (` ((, (code.text def_code)))))))))))
(all list#composite
/check.documentation
diff --git a/stdlib/source/documentation/lux/meta/macro/syntax/declaration.lux b/stdlib/source/documentation/lux/meta/macro/syntax/declaration.lux
index 77290d620..725545e96 100644
--- a/stdlib/source/documentation/lux/meta/macro/syntax/declaration.lux
+++ b/stdlib/source/documentation/lux/meta/macro/syntax/declaration.lux
@@ -23,7 +23,8 @@
($.definition /.parser
"A parser for declaration syntax."
- ["Such as:"
- quux
- (foo bar baz)])
+
+ ($.comment "Such as:")
+ ($.example quux)
+ ($.example (foo bar baz)))
))
diff --git a/stdlib/source/documentation/lux/meta/macro/syntax/definition.lux b/stdlib/source/documentation/lux/meta/macro/syntax/definition.lux
index e429ba035..08a7d5b08 100644
--- a/stdlib/source/documentation/lux/meta/macro/syntax/definition.lux
+++ b/stdlib/source/documentation/lux/meta/macro/syntax/definition.lux
@@ -24,9 +24,9 @@
($.definition /.parser
"A reader that first macro-expands and then analyses the input Code, to ensure it is a definition."
- [(parser compiler)])
+ ($.example (parser compiler)))
($.definition /.typed
"Only works for typed definitions."
- [(typed compiler)])
+ ($.example (typed compiler)))
))
diff --git a/stdlib/source/documentation/lux/meta/macro/syntax/export.lux b/stdlib/source/documentation/lux/meta/macro/syntax/export.lux
index 10191449c..4b7437339 100644
--- a/stdlib/source/documentation/lux/meta/macro/syntax/export.lux
+++ b/stdlib/source/documentation/lux/meta/macro/syntax/export.lux
@@ -17,7 +17,7 @@
($.definition /.default)
- ($.definition /.parser
+ ($.definition /.with
""
- [(parser un_exported)])
+ ($.example (with un_exported)))
))
diff --git a/stdlib/source/documentation/lux/meta/macro/template.lux b/stdlib/source/documentation/lux/meta/macro/template.lux
index 4ef001ef4..688558043 100644
--- a/stdlib/source/documentation/lux/meta/macro/template.lux
+++ b/stdlib/source/documentation/lux/meta/macro/template.lux
@@ -19,48 +19,49 @@
($.definition /.spliced
""
- [(spliced [a b c d])
- "=>"
- a
- b
- c
- d])
+ ($.example (spliced [a b c d]))
+ ($.comment "=>")
+ ($.example a)
+ ($.example b)
+ ($.example c)
+ ($.example d))
($.definition /.amount
""
- [(amount [a b c d])
- "=>"
- 4])
+ ($.example (amount [a b c d]))
+ ($.comment "=>")
+ ($.example 4))
($.definition /.with_locals
"Creates names for local bindings aliased by the names you choose."
- [(with_locals [my_var]
- (let [my_var 123]
- (text [my_var])))
- "=>"
- "__gensym__my_var506"])
+ ($.example (with_locals [my_var]
+ (let [my_var 123]
+ (text [my_var]))))
+ ($.comment "=>")
+ ($.example "__gensym__my_var506"))
($.definition /.text
"A text literal made by concatenating pieces of code."
- [(text [#0 123 +456 +789.0 "abc" .def ..ghi])
- "=>"
- "#0123+456+789.0abcdefghi"])
+ ($.example (text [#0 123 +456 +789.0 "abc" .def ..ghi]))
+ ($.comment "=>")
+ ($.example "#0123+456+789.0abcdefghi"))
($.definition /.symbol
(format "An symbol made by concatenating pieces of code."
\n "The (optional) module part and the short part are specified independently.")
- [(symbol ["abc" .def ..ghi])
- "=>"
- abcdefghi]
- [(symbol [.def] ["abc" .def ..ghi])
- "=>"
- .abcdefghi])
+ ($.example (symbol ["abc" .def ..ghi]))
+ ($.comment "=>")
+ ($.example abcdefghi)
+
+ ($.example (symbol [.def] ["abc" .def ..ghi]))
+ ($.comment "=>")
+ ($.example .abcdefghi))
($.definition /.let
"Lexically-bound templates."
- [(let [(!square <root>)
- [(* <root> <root>)]]
- (def (square root)
- (-> Nat Nat)
- (!square root)))])
+ ($.example (let [(!square <root>)
+ [(* <root> <root>)]]
+ (def (square root)
+ (-> Nat Nat)
+ (!square root)))))
))
diff --git a/stdlib/source/documentation/lux/meta/static.lux b/stdlib/source/documentation/lux/meta/static.lux
index cd5168c83..b2179dcba 100644
--- a/stdlib/source/documentation/lux/meta/static.lux
+++ b/stdlib/source/documentation/lux/meta/static.lux
@@ -27,11 +27,11 @@
($.definition /.literal
""
- [(/.literal
- (is (-> ??? Code)
- format)
- (is ???
- (value generating expression)))]))
+ ($.example (/.literal
+ (is (-> ??? Code)
+ format)
+ (is ???
+ (value generating expression))))))
random (list (,, (with_template [<name> <type>]
[($.definition <name>
(%.code (' (is <type>
@@ -45,11 +45,11 @@
($.definition /.random
""
- [(/.random
- (is (-> ??? Code)
- format)
- (is (Random ???)
- (random data generator)))]))]
+ ($.example (/.random
+ (is (-> ??? Code)
+ format)
+ (is (Random ???)
+ (random data generator))))))]
(list.partial ($.module /._
"")
diff --git a/stdlib/source/documentation/lux/meta/type.lux b/stdlib/source/documentation/lux/meta/type.lux
index 4e2d13faa..292b084f2 100644
--- a/stdlib/source/documentation/lux/meta/type.lux
+++ b/stdlib/source/documentation/lux/meta/type.lux
@@ -61,7 +61,7 @@
($.definition \\parser.result
(format "Applies a parser against a type."
\n "Verifies that the parser fully consumes the type's information.")
- [(result poly type)])
+ ($.example (result poly type)))
($.definition \\parser.env
"Yields the current parsing environment.")
@@ -74,11 +74,11 @@
($.definition \\parser.local
"Apply a parser to the given inputs."
- [(local types poly)])
+ ($.example (local types poly)))
($.definition \\parser.with_extension
""
- [(with_extension type poly)])
+ ($.example (with_extension type poly)))
(,, (with_template [<name>]
[(`` ($.definition <name>
@@ -90,15 +90,15 @@
($.definition \\parser.polymorphic
""
- [(polymorphic poly)])
+ ($.example (polymorphic poly)))
($.definition \\parser.function
"Parses a function's inputs and output."
- [(function in_poly out_poly)])
+ ($.example (function in_poly out_poly)))
($.definition \\parser.applied
"Parses a type application."
- [(applied poly)])
+ ($.example (applied poly)))
(,, (with_template [<name> <doc>]
[($.definition <name>
@@ -111,11 +111,11 @@
($.definition \\parser.argument
""
- [(argument env idx)])
+ ($.example (argument env idx)))
($.definition \\parser.this_parameter
""
- [(this_parameter id)])
+ ($.example (this_parameter id)))
($.definition \\parser.existential
"Yields an existential type.")
@@ -125,7 +125,7 @@
($.definition \\parser.recursive
""
- [(recursive poly)])
+ ($.example (recursive poly)))
)))
(`` (def .public documentation
@@ -145,11 +145,11 @@
($.definition /.flat_function
"The input, and the output of a function type."
- [(flat_function type)])
+ ($.example (flat_function type)))
($.definition /.flat_application
"The quantified type, and its parameters, for a type-application."
- [(flat_application type)])
+ ($.example (flat_application type)))
(,, (with_template [<name>]
[($.definition <name>
@@ -161,24 +161,24 @@
($.definition /.format
"A (readable) textual representable of a type."
- [(format type)])
+ ($.example (format type)))
($.definition /.applied
"To the extend possible, applies a quantified type to the given parameters."
- [(applied params func)])
+ ($.example (applied params func)))
($.definition /.code
(%.format "A representation of a type as code."
\n "The code is such that evaluating it would yield the type value.")
- [(code type)])
+ ($.example (code type)))
($.definition /.de_aliased
"A (potentially named) type that does not have its name shadowed by other names."
- [(de_aliased type)])
+ ($.example (de_aliased type)))
($.definition /.anonymous
"A type without any names covering it."
- [(anonymous type)])
+ ($.example (anonymous type)))
(,, (with_template [<name>]
[($.definition <name>
@@ -190,11 +190,11 @@
($.definition /.function
"A function type, with the given inputs and output."
- [(function inputs output)])
+ ($.example (function inputs output)))
($.definition /.application
"An un-evaluated type application, with the given quantified type, and parameters."
- [(application params quant)])
+ ($.example (application params quant)))
(,, (with_template [<name>]
[($.definition <name>
@@ -206,63 +206,65 @@
($.definition /.quantified?
"Only yields #1 for universally or existentially quantified types."
- [(quantified? type)])
+ ($.example (quantified? type)))
($.definition /.array
"An array type, with the given level of nesting/depth, and the given element type."
- [(array depth element_type)])
+ ($.example (array depth element_type)))
($.definition /.flat_array
"The level of nesting/depth and element type for an array type."
- [(flat_array type)])
+ ($.example (flat_array type)))
($.definition /.array?
"Is a type an array type?")
($.definition /.log!
"Logs to the console/terminal the type of an expression."
- [(log! (is Foo (foo expression)))
- "=>"
- "Expression: (foo expression)"
- " Type: Foo"
- (foo expression)])
+
+ ($.example (log! (is Foo (foo expression))))
+ ($.comment "=>")
+ ($.comment "Expression: (foo expression)")
+ ($.comment " Type: Foo")
+ ($.example (foo expression)))
($.definition /.as
(%.format "Casts a value to a specific type."
\n "The specified type can depend on type variables of the original type of the value."
\n "NOTE: Careless use of type-casts is an easy way to introduce bugs. USE WITH CAUTION.")
- [(is (Bar Bit Nat Text)
- (as [a b c]
- (Foo a [b c])
- (Bar a b c)
- (is (Foo Bit [Nat Text])
- (foo expression))))])
+ ($.example (is (Bar Bit Nat Text)
+ (as [a b c]
+ (Foo a [b c])
+ (Bar a b c)
+ (is (Foo Bit [Nat Text])
+ (foo expression))))))
($.definition /.sharing
"Allows specifing the type of an expression as sharing type-variables with the type of another expression."
- [(is (Bar Bit Nat Text)
- (sharing [a b c]
- (is (Foo a [b c])
- (is (Foo Bit [Nat Text])
- (foo expression)))
- (is (Bar a b c)
- (bar expression))))])
+ ($.example (is (Bar Bit Nat Text)
+ (sharing [a b c]
+ (is (Foo a [b c])
+ (is (Foo Bit [Nat Text])
+ (foo expression)))
+ (is (Bar a b c)
+ (bar expression))))))
($.definition /.by_example
"Constructs a type that shares type-variables with an expression of some other type."
- [(is Type
- (by_example [a b c]
- (is (Foo a [b c])
- (is (Foo Bit [Nat Text])
- (foo expression)))
- (Bar a b c)))
- "=>"
- (.type_literal (Bar Bit Nat Text))])
+
+ ($.example (is Type
+ (by_example [a b c]
+ (is (Foo a [b c])
+ (is (Foo Bit [Nat Text])
+ (foo expression)))
+ (Bar a b c))))
+ ($.comment "=>")
+ ($.example (.type_literal (Bar Bit Nat Text))))
($.definition /.let
"Local bindings for types."
- [(let [side (Either Int Frac)]
- (List [side side]))])
+ ($.example (let [side (Either Int Frac)]
+ (List [side side]))))
(all list#composite
..\\parser
diff --git a/stdlib/source/documentation/lux/meta/type/check.lux b/stdlib/source/documentation/lux/meta/type/check.lux
index 55cbfd5b1..82fd02c56 100644
--- a/stdlib/source/documentation/lux/meta/type/check.lux
+++ b/stdlib/source/documentation/lux/meta/type/check.lux
@@ -33,19 +33,19 @@
($.definition /.result
""
- [(result context proc)])
+ ($.example (result context proc)))
($.definition /.failure
""
- [(failure message)])
+ ($.example (failure message)))
($.definition /.assertion
""
- [(assertion message test)])
+ ($.example (assertion message test)))
($.definition /.except
""
- [(except exception message)])
+ ($.example (except exception message)))
($.definition /.existential
"A brand-new existential type.")
@@ -53,7 +53,7 @@
($.definition /.bind
(format "Attemmpts to buy a type-variable."
\n "Fails if the variable has been bound already.")
- [(bind type id)])
+ ($.example (bind type id)))
($.definition /.var
"A brand-new (unbound) type-variable.")
@@ -63,16 +63,16 @@
($.definition /.check
"Type-check to ensure that the 'expected' type subsumes the 'actual' type."
- [(check expected actual)])
+ ($.example (check expected actual)))
($.definition /.subsumes?
"A simple type-checking function that just returns a yes/no answer."
- [(subsumes? expected actual)])
+ ($.example (subsumes? expected actual)))
($.definition /.context
"The current state of the type-checking context.")
($.definition /.clean
"Resolves every bound type-variable to yield a new type that is as resolved as possible."
- [(clean inputT)])
+ ($.example (clean inputT)))
))
diff --git a/stdlib/source/documentation/lux/meta/type/dynamic.lux b/stdlib/source/documentation/lux/meta/type/dynamic.lux
index af54272d6..18db9468f 100644
--- a/stdlib/source/documentation/lux/meta/type/dynamic.lux
+++ b/stdlib/source/documentation/lux/meta/type/dynamic.lux
@@ -21,11 +21,11 @@
($.definition /.dynamic
""
- [(is Dynamic
- (dynamic 123))])
+ ($.example (is Dynamic
+ (dynamic 123))))
($.definition /.static
""
- [(is (try.Try Nat)
- (static Nat (dynamic 123)))])
+ ($.example (is (try.Try Nat)
+ (static Nat (dynamic 123)))))
))
diff --git a/stdlib/source/documentation/lux/meta/type/implicit.lux b/stdlib/source/documentation/lux/meta/type/implicit.lux
index 54ded8081..4803008c0 100644
--- a/stdlib/source/documentation/lux/meta/type/implicit.lux
+++ b/stdlib/source/documentation/lux/meta/type/implicit.lux
@@ -25,28 +25,30 @@
\n "a compile-time error will be raised, to alert the user."
\n \n "Caveat emptor: You need to make sure to import the module of any implementation you want to use."
\n "Otherwise, this macro will not find it.")
- ["Nat equivalence"
- (at number.equivalence = x y)
- (a/an = x y)]
- ["Can optionally add the prefix of the module where the signature was defined."
- (a/an equivalence.= x y)]
- ["(List Nat) equivalence"
- (a/an =
- (list.indices 10)
- (list.indices 10))]
- ["(Functor List) each"
- (a/an each ++ (list.indices 10))])
+ ($.example ($.comment "Nat equivalence"))
+ ($.example (at number.equivalence = x y))
+ ($.example (a/an = x y))
+
+ ($.comment "Can optionally add the prefix of the module where the signature was defined.")
+ ($.example (a/an equivalence.= x y))
+
+ ($.comment "(List Nat) equivalence")
+ ($.example (a/an =
+ (list.indices 10)
+ (list.indices 10)))
+
+ ($.comment "(Functor List) each")
+ ($.example (a/an each ++ (list.indices 10))))
($.definition /.with
"Establish lexical bindings for implementations that will be prioritized over non-lexically-bound implementations."
- [(with [n.addition]
- (n.= (at n.addition composite left right)
- (a/an composite left right)))])
+ ($.example (with [n.addition]
+ (n.= (at n.addition composite left right)
+ (a/an composite left right)))))
($.definition /.implicitly
"Establish local definitions for implementations that will be prioritized over foreign definitions."
- [(implicitly n.multiplication)
-
- (n.= (at n.multiplication composite left right)
- (a/an composite left right))])
+ ($.example (implicitly n.multiplication))
+ ($.example (n.= (at n.multiplication composite left right)
+ (a/an composite left right))))
))
diff --git a/stdlib/source/documentation/lux/meta/type/poly.lux b/stdlib/source/documentation/lux/meta/type/poly.lux
index fb33e6236..b781bb5c8 100644
--- a/stdlib/source/documentation/lux/meta/type/poly.lux
+++ b/stdlib/source/documentation/lux/meta/type/poly.lux
@@ -21,5 +21,5 @@
($.definition /.code
""
- [(code env type)])
+ ($.example (code env type)))
))
diff --git a/stdlib/source/documentation/lux/meta/type/primitive.lux b/stdlib/source/documentation/lux/meta/type/primitive.lux
index 04a751666..036489d22 100644
--- a/stdlib/source/documentation/lux/meta/type/primitive.lux
+++ b/stdlib/source/documentation/lux/meta/type/primitive.lux
@@ -21,15 +21,15 @@
($.definition /.specific
"A specific abstract/nominal type still being defined somewhere in the scope."
- [(specific name)])
+ ($.example (specific name)))
(,, (with_template [<name> <from> <$> <to>]
[($.definition <name>
"Type-casting macro for abstract/nominal types."
- [(|> value
- (is <from>)
- <$>
- (is <to>))])]
+ ($.example (|> value
+ (is <from>)
+ <$>
+ (is <to>))))]
[/.abstraction Representation abstraction Abstraction]
[/.representation Abstraction representation Representation]
@@ -38,82 +38,85 @@
($.definition /.def
(format "Define abstract/nominal types which hide their representation details."
\n "You can convert between the abstraction and its representation selectively to access the value, while hiding it from others.")
- [(/.def String
- Text
-
- (.def (string value)
- (-> Text String)
- (abstraction value))
-
- (.def (text value)
- (-> String Text)
- (representation value)))]
- ["Type-parameters are optional."
- (/.def (Duplicate a)
- [a a]
-
- (.def (duplicate value)
- (All (_ a) (-> a (Duplicate a)))
- (abstraction [value value])))]
- ["Definitions can be nested."
- (/.def (Single a)
- a
-
- (.def (single value)
- (All (_ a) (-> a (Single a)))
- (abstraction value))
-
- (/.def (Double a)
- [a a]
-
- (.def (double value)
- (All (_ a) (-> a (Double a)))
- (abstraction [value value]))
-
- (.def (single' value)
- (All (_ a) (-> a (Single a)))
- (abstraction Single [value value]))
-
- (let [value 0123]
- (same? value
- (|> value
- single'
- (representation Single)
- double
- representation)))))]
- ["Type-parameters do not necessarily have to be used in the representation type."
- "If they are not used, they become phantom types and can be used to customize types without changing the representation."
- (/.def (JavaScript a)
- Text
-
- (/.def Expression Any)
- (/.def Statement Any)
-
- (.def (+ x y)
- (-> (JavaScript Expression) (JavaScript Expression) (JavaScript Expression))
- (abstraction
- (format "(" (representation x) "+" (representation y) ")")))
-
- (.def (while test body)
- (-> (JavaScript Expression) (JavaScript Statement) (JavaScript Statement))
- (abstraction
- (format "while(" (representation test) ") {"
- (representation body)
- "}"))))])
+ ($.example (/.def String
+ Text
+
+ (.def (string value)
+ (-> Text String)
+ (abstraction value))
+
+ (.def (text value)
+ (-> String Text)
+ (representation value))))
+
+ ($.comment "Type-parameters are optional.")
+ ($.example (/.def (Duplicate a)
+ [a a]
+
+ (.def (duplicate value)
+ (All (_ a) (-> a (Duplicate a)))
+ (abstraction [value value]))))
+
+ ($.comment "Definitions can be nested.")
+ ($.example (/.def (Single a)
+ a
+
+ (.def (single value)
+ (All (_ a) (-> a (Single a)))
+ (abstraction value))
+
+ (/.def (Double a)
+ [a a]
+
+ (.def (double value)
+ (All (_ a) (-> a (Double a)))
+ (abstraction [value value]))
+
+ (.def (single' value)
+ (All (_ a) (-> a (Single a)))
+ (abstraction Single [value value]))
+
+ (let [value 0123]
+ (same? value
+ (|> value
+ single'
+ (representation Single)
+ double
+ representation))))))
+
+ ($.comment "Type-parameters do not necessarily have to be used in the representation type.")
+ ($.comment "If they are not used, they become phantom types and can be used to customize types without changing the representation.")
+ ($.example (/.def (JavaScript a)
+ Text
+
+ (/.def Expression Any)
+ (/.def Statement Any)
+
+ (.def (+ x y)
+ (-> (JavaScript Expression) (JavaScript Expression) (JavaScript Expression))
+ (abstraction
+ (format "(" (representation x) "+" (representation y) ")")))
+
+ (.def (while test body)
+ (-> (JavaScript Expression) (JavaScript Statement) (JavaScript Statement))
+ (abstraction
+ (format "while(" (representation test) ") {"
+ (representation body)
+ "}"))))))
($.definition /.transmutation
"Transmutes an abstract/nominal type's phantom types."
- [(/.def (JavaScript a)
- Text
+ ($.example (/.def (JavaScript a)
+ Text
- (/.def Expression Any)
- (/.def Statement Any)
+ (/.def Expression Any)
+ (/.def Statement Any)
- (.def (statement expression)
- (-> (JavaScript Expression) (JavaScript Statement))
- (transmutation expression))
+ (.def (statement expression)
+ (-> (JavaScript Expression) (JavaScript Statement))
+ (transmutation expression))
- (.def (statement' expression)
- (-> (JavaScript Expression) (JavaScript Statement))
- (transmutation JavaScript expression)))])
+ (.def (statement' expression)
+ (-> (JavaScript Expression) (JavaScript Statement))
+ (transmutation JavaScript expression)))))
)))
diff --git a/stdlib/source/documentation/lux/meta/type/quotient.lux b/stdlib/source/documentation/lux/meta/type/quotient.lux
index e374a11c5..07d3c0751 100644
--- a/stdlib/source/documentation/lux/meta/type/quotient.lux
+++ b/stdlib/source/documentation/lux/meta/type/quotient.lux
@@ -28,17 +28,16 @@
($.definition /.quotient
""
- [(quotient class value)])
+ ($.example (quotient class value)))
($.definition /.type
"The Quotient type associated with a Class type."
- [(def even
- (class even?))
- (def Even
- Type
- (type even))
-
- (is Even
- (quotient even 123))])
+ ($.example (def even
+ (class even?)))
+ ($.example (def Even
+ Type
+ (type even)))
+ ($.example (is Even
+ (quotient even 123))))
))
diff --git a/stdlib/source/documentation/lux/meta/type/refinement.lux b/stdlib/source/documentation/lux/meta/type/refinement.lux
index 0b9601f1e..104a57b3e 100644
--- a/stdlib/source/documentation/lux/meta/type/refinement.lux
+++ b/stdlib/source/documentation/lux/meta/type/refinement.lux
@@ -24,30 +24,29 @@
($.definition /.refiner
""
- [(refiner predicate)])
+ ($.example (refiner predicate)))
($.definition /.lifted
(format "Yields a function that can work on refined values."
\n "Respects the constraints of the refinement.")
- [(lifted transform)])
+ ($.example (lifted transform)))
($.definition /.only
""
- [(only refiner values)])
+ ($.example (only refiner values)))
($.definition /.partition
"Separates refined values from the un-refined ones."
- [(partition refiner values)])
+ ($.example (partition refiner values)))
($.definition /.type
"The Refined type associated with a Refiner type."
- [(def even
- (refiner even?))
-
- (def Even
- Type
- (type even))
-
- (is (Maybe Even)
- (even 123))])
+
+ ($.example (def even
+ (refiner even?)))
+ ($.example (def Even
+ Type
+ (type even)))
+ ($.example (is (Maybe Even)
+ (even 123))))
))
diff --git a/stdlib/source/documentation/lux/meta/type/resource.lux b/stdlib/source/documentation/lux/meta/type/resource.lux
index ed1f271f3..c8e34ab6e 100644
--- a/stdlib/source/documentation/lux/meta/type/resource.lux
+++ b/stdlib/source/documentation/lux/meta/type/resource.lux
@@ -35,11 +35,11 @@
($.definition /.run!
""
- [(run! monad procedure)])
+ ($.example (run! monad procedure)))
($.definition /.lifted
""
- [(lifted monad procedure)])
+ ($.example (lifted monad procedure)))
($.definition /.Ordered
"The mode of keys which CANNOT be swapped, and for whom order of release/consumption matters.")
@@ -65,31 +65,31 @@
($.definition /.read
"Access the value of a resource, so long as its key is available."
- [(read monad resource)])
+ ($.example (read monad resource)))
($.definition /.exchange
(format "A function that can exchange the keys for resource, so long as they are commutative."
\n "This keys will be placed at the front of the keyring in the order they are specified."
\n "The specific keys must be specified based of their index into the current keyring.")
- [(do (monad !)
- [res|left (commutative ! pre)
- res|right (commutative ! post)
- _ ((exchange [1 0]) !)
- left (read ! res|left)
- right (read ! res|right)]
- (in (format left right)))])
+ ($.example (do (monad !)
+ [res|left (commutative ! pre)
+ res|right (commutative ! post)
+ _ ((exchange [1 0]) !)
+ left (read ! res|left)
+ right (read ! res|right)]
+ (in (format left right)))))
(,, (with_template [<name>]
[($.definition <name>
"Group/un-group keys in the keyring into/out-of tuples."
- [(do (monad !)
- [res|left (commutative ! pre)
- res|right (commutative ! post)
- _ ((group 2) !)
- _ ((un_group 2) !)
- right (read ! res|right)
- left (read ! res|left)]
- (in (format left right)))])]
+ ($.example (do (monad !)
+ [res|left (commutative ! pre)
+ res|right (commutative ! post)
+ _ ((group 2) !)
+ _ ((un_group 2) !)
+ right (read ! res|right)
+ left (read ! res|left)]
+ (in (format left right)))))]
[/.group]
[/.un_group]
diff --git a/stdlib/source/documentation/lux/meta/type/unit.lux b/stdlib/source/documentation/lux/meta/type/unit.lux
index 606184c7a..67157d892 100644
--- a/stdlib/source/documentation/lux/meta/type/unit.lux
+++ b/stdlib/source/documentation/lux/meta/type/unit.lux
@@ -54,15 +54,15 @@
($.definition /.unit
(format "Define a unit of measurement."
\n "Both the name of the type, and the name of the Unit implementation must be specified.")
- [(def feet (unit []))])
+ ($.example (def feet (unit []))))
... ($.definition /.scale
... "Define a scale of magnitude."
- ... [(def bajillion (scale [1 1,234,567,890]))])
+ ... ($.example (def bajillion (scale [1 1,234,567,890]))))
... ($.definition /.re_scaled
... ""
- ... [(re_scaled from to measure)])
+ ... ($.example (re_scaled from to measure)))
... (,, (with_template [<type> <scale>]
... [(`` ($.definition <scale>