From b96beb587c11fcfbce86ce2d62351600cf6cad1b Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 2 Jul 2022 05:38:27 -0400 Subject: More traditional names for unquoting macros. --- stdlib/source/documentation/lux.lux | 30 ++-- stdlib/source/documentation/lux/abstract.lux | 4 +- .../documentation/lux/abstract/predicate.lux | 42 ------ stdlib/source/documentation/lux/control.lux | 5 +- .../documentation/lux/control/concatenative.lux | 8 +- .../source/documentation/lux/control/function.lux | 6 +- .../lux/control/function/predicate.lux | 42 ++++++ .../documentation/lux/control/parser/analysis.lux | 4 +- .../documentation/lux/control/parser/code.lux | 6 +- .../documentation/lux/control/parser/json.lux | 6 +- .../documentation/lux/control/parser/synthesis.lux | 4 +- .../documentation/lux/control/parser/text.lux | 6 +- .../documentation/lux/control/parser/type.lux | 2 +- .../lux/control/security/capability.lux | 51 +++---- .../documentation/lux/control/security/policy.lux | 122 +++++++-------- .../documentation/lux/data/collection/array.lux | 5 +- .../documentation/lux/data/collection/bits.lux | 10 +- .../lux/data/collection/dictionary.lux | 9 +- .../lux/data/collection/dictionary/ordered.lux | 7 +- .../documentation/lux/data/collection/list.lux | 9 +- .../lux/data/collection/list/property.lux | 9 +- .../documentation/lux/data/collection/queue.lux | 8 +- .../lux/data/collection/queue/priority.lux | 8 +- .../documentation/lux/data/collection/sequence.lux | 8 +- .../documentation/lux/data/collection/stream.lux | 7 +- stdlib/source/documentation/lux/data/color.lux | 7 +- .../source/documentation/lux/data/color/named.lux | 5 +- .../source/documentation/lux/data/format/json.lux | 2 +- .../documentation/lux/data/text/encoding.lux | 2 +- .../documentation/lux/data/text/unicode/block.lux | 2 +- stdlib/source/documentation/lux/extension.lux | 3 +- stdlib/source/documentation/lux/ffi.jvm.lux | 10 +- stdlib/source/documentation/lux/ffi.old.lux | 2 +- stdlib/source/documentation/lux/macro.lux | 14 +- stdlib/source/documentation/lux/macro/syntax.lux | 2 +- stdlib/source/documentation/lux/math/number.lux | 2 +- .../source/documentation/lux/math/number/frac.lux | 6 +- .../source/documentation/lux/math/number/i64.lux | 4 +- .../source/documentation/lux/math/number/int.lux | 4 +- .../source/documentation/lux/math/number/nat.lux | 4 +- .../source/documentation/lux/math/number/rev.lux | 4 +- stdlib/source/documentation/lux/meta.lux | 10 +- stdlib/source/documentation/lux/meta/type.lux | 167 +++++++++++++++++++++ .../source/documentation/lux/meta/type/check.lux | 79 ++++++++++ .../source/documentation/lux/meta/type/dynamic.lux | 32 ++++ .../documentation/lux/meta/type/implicit.lux | 53 +++++++ stdlib/source/documentation/lux/meta/type/poly.lux | 26 ++++ .../documentation/lux/meta/type/primitive.lux | 120 +++++++++++++++ .../documentation/lux/meta/type/quotient.lux | 45 ++++++ .../documentation/lux/meta/type/refinement.lux | 54 +++++++ .../documentation/lux/meta/type/resource.lux | 98 ++++++++++++ stdlib/source/documentation/lux/meta/type/unit.lux | 89 +++++++++++ .../documentation/lux/meta/type/variance.lux | 25 +++ stdlib/source/documentation/lux/static.lux | 4 +- stdlib/source/documentation/lux/time.lux | 2 +- stdlib/source/documentation/lux/type.lux | 167 --------------------- stdlib/source/documentation/lux/type/check.lux | 79 ---------- stdlib/source/documentation/lux/type/dynamic.lux | 32 ---- stdlib/source/documentation/lux/type/implicit.lux | 53 ------- stdlib/source/documentation/lux/type/poly.lux | 26 ---- stdlib/source/documentation/lux/type/primitive.lux | 120 --------------- stdlib/source/documentation/lux/type/quotient.lux | 45 ------ .../source/documentation/lux/type/refinement.lux | 54 ------- stdlib/source/documentation/lux/type/resource.lux | 98 ------------ stdlib/source/documentation/lux/type/unit.lux | 89 ----------- stdlib/source/documentation/lux/type/variance.lux | 25 --- stdlib/source/documentation/lux/world/console.lux | 4 +- stdlib/source/documentation/lux/world/file.lux | 4 +- .../source/documentation/lux/world/file/watch.lux | 8 +- .../documentation/lux/world/net/http/client.lux | 6 +- .../documentation/lux/world/net/http/status.lux | 2 +- .../lux/world/output/video/resolution.lux | 2 +- stdlib/source/documentation/lux/world/shell.lux | 4 +- 73 files changed, 1030 insertions(+), 1083 deletions(-) delete mode 100644 stdlib/source/documentation/lux/abstract/predicate.lux create mode 100644 stdlib/source/documentation/lux/control/function/predicate.lux create mode 100644 stdlib/source/documentation/lux/meta/type.lux create mode 100644 stdlib/source/documentation/lux/meta/type/check.lux create mode 100644 stdlib/source/documentation/lux/meta/type/dynamic.lux create mode 100644 stdlib/source/documentation/lux/meta/type/implicit.lux create mode 100644 stdlib/source/documentation/lux/meta/type/poly.lux create mode 100644 stdlib/source/documentation/lux/meta/type/primitive.lux create mode 100644 stdlib/source/documentation/lux/meta/type/quotient.lux create mode 100644 stdlib/source/documentation/lux/meta/type/refinement.lux create mode 100644 stdlib/source/documentation/lux/meta/type/resource.lux create mode 100644 stdlib/source/documentation/lux/meta/type/unit.lux create mode 100644 stdlib/source/documentation/lux/meta/type/variance.lux delete mode 100644 stdlib/source/documentation/lux/type.lux delete mode 100644 stdlib/source/documentation/lux/type/check.lux delete mode 100644 stdlib/source/documentation/lux/type/dynamic.lux delete mode 100644 stdlib/source/documentation/lux/type/implicit.lux delete mode 100644 stdlib/source/documentation/lux/type/poly.lux delete mode 100644 stdlib/source/documentation/lux/type/primitive.lux delete mode 100644 stdlib/source/documentation/lux/type/quotient.lux delete mode 100644 stdlib/source/documentation/lux/type/refinement.lux delete mode 100644 stdlib/source/documentation/lux/type/resource.lux delete mode 100644 stdlib/source/documentation/lux/type/unit.lux delete mode 100644 stdlib/source/documentation/lux/type/variance.lux (limited to 'stdlib/source/documentation') diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index 0b0e815a7..7be9e1622 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -34,7 +34,6 @@ ["[1][0]" test] ["[1][0]" time] ["[1][0]" tool] ... TODO: Documentation for this - ["[1][0]" type] ["[1][0]" world]]) (.`` (.def .public documentation @@ -235,18 +234,18 @@ ($.documentation /.` (format "Hygienic quasi-quotation as a macro." - \n "Unquote (~) and unquote-splice (~+) must also be used as forms." + \n "Unquote (,) and unquote-splice (,*) must also be used as forms." \n "All unprefixed macros will receive their parent module's prefix if imported; otherwise will receive the prefix of the module on which the quasi-quote is being used.") - [(` (def (~ name) - (function ((~' _) (~+ args)) - (~ body))))]) + [(` (def (, name) + (function ((,' _) (,* args)) + (, body))))]) ($.documentation /.`' (format "Unhygienic quasi-quotation as a macro." - \n "Unquote (~) and unquote-splice (~+) must also be used as forms.") - [(`' (def (~ name) - (function (_ (~+ args)) - (~ body))))]) + \n "Unquote (,) and unquote-splice (,*) must also be used as forms.") + [(`' (def (, name) + (function (_ (,* args)) + (, body))))]) ($.documentation /.' "Quotation as a macro." @@ -430,7 +429,7 @@ (case tokens (^with_template [] [(pattern (list [_ { [module name]}])) - (in (list (` [(~ (text$ module)) (~ (text$ name))])))]) + (in (list (` [(, (text$ module)) (, (text$ name))])))]) ([#Symbol]) _ @@ -502,7 +501,7 @@ (is (-> a a Bit) <)))]) - (.~~ (.with_template [] + (.,, (.with_template [] [($.documentation "Safe type-casting for I64 values.")] @@ -655,7 +654,7 @@ ... type ... ))]) - (.~~ (.with_template [ ] + (.,, (.with_template [ ] [($.documentation )] @@ -846,15 +845,15 @@ ($.documentation /.`` (format "Delimits a controlled (spliced) macro-expansion." - \n "Uses a (~~) special form to specify where to expand.") + \n "Uses a (,,) special form to specify where to expand.") [(`` (some expression - (~~ (some macro which may yield 0 or more results))))]) + (,, (some macro which may yield 0 or more results))))]) ... ($.documentation /.^code ... "Generates pattern-matching code for Code values in a way that looks like code-templating." ... [(is (Maybe Nat) ... (case (` (#0 123 +456.789)) - ... (^code (#0 (~ [_ {.#Nat number}]) +456.789)) + ... (^code (#0 (, [_ {.#Nat number}]) +456.789)) ... {.#Some number} ... _ @@ -908,7 +907,6 @@ /test.documentation /time.documentation /tool.documentation - /type.documentation /world.documentation]))) (program: inputs diff --git a/stdlib/source/documentation/lux/abstract.lux b/stdlib/source/documentation/lux/abstract.lux index 52febba83..9e4d591ec 100644 --- a/stdlib/source/documentation/lux/abstract.lux +++ b/stdlib/source/documentation/lux/abstract.lux @@ -17,8 +17,7 @@ ["[1][0]" interval] ["[1][0]" monad] ["[1][0]" monoid] - ["[1][0]" order] - ["[1][0]" predicate]]) + ["[1][0]" order]]) (.def .public documentation (.List $.Module) @@ -35,5 +34,4 @@ /monad.documentation /monoid.documentation /order.documentation - /predicate.documentation ))) diff --git a/stdlib/source/documentation/lux/abstract/predicate.lux b/stdlib/source/documentation/lux/abstract/predicate.lux deleted file mode 100644 index e8507ce02..000000000 --- a/stdlib/source/documentation/lux/abstract/predicate.lux +++ /dev/null @@ -1,42 +0,0 @@ -(.require - [library - [lux - ["$" documentation] - [data - [text (.only \n) - ["%" \\format (.only format)]]]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.default /.union) - ($.default /.intersection) - ($.default /.functor) - - ($.documentation (/.Predicate it) - "A question that can be asked of a value, yield either false (#0) or true (#1).") - - ($.documentation /.none - "A predicate that always fails.") - - ($.documentation /.or - "A predicate that meets either predecessor.") - - ($.documentation /.all - "A predicate that always succeeds.") - - ($.documentation /.and - "A predicate that meets both predecessors.") - - ($.documentation /.complement - "The opposite of a predicate.") - - ($.documentation /.difference - "A predicate that meeds 'base', but not 'sub'.") - - ($.documentation /.rec - "Ties the knot for a recursive predicate.")] - [])) diff --git a/stdlib/source/documentation/lux/control.lux b/stdlib/source/documentation/lux/control.lux index e4bfc0433..94b5981ee 100644 --- a/stdlib/source/documentation/lux/control.lux +++ b/stdlib/source/documentation/lux/control.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text (.only \n) ["%" \\format (.only format)]] @@ -25,8 +25,7 @@ ["[1][0]" state] ["[1][0]" thread] ["[1][0]" try] - ["[1][0]" writer] - ]) + ["[1][0]" writer]]) (.def .public documentation (.List $.Module) diff --git a/stdlib/source/documentation/lux/control/concatenative.lux b/stdlib/source/documentation/lux/control/concatenative.lux index 2f553ce34..d300fd7fd 100644 --- a/stdlib/source/documentation/lux/control/concatenative.lux +++ b/stdlib/source/documentation/lux/control/concatenative.lux @@ -41,7 +41,7 @@ [(is (=> [Nat] [Nat]) ((apply 1) ++))]) - (~~ (with_template [] + (,, (with_template [] [(with_expansions [ (template.symbol [/._] ["apply_" ]) (template.text ["Lift a function of arity " " into a concatenative function of arity " "."])] @@ -82,9 +82,9 @@ ($.documentation /.right "Right-injects the top into sum.") - (~~ (with_template [ ] - [(`` ($.documentation (~~ (template.symbol [/._] [])) - (~~ (template.text [ " for " " arithmetic."]))))] + (,, (with_template [ ] + [(`` ($.documentation (,, (template.symbol [/._] [])) + (,, (template.text [ " for " " arithmetic."]))))] [Nat n/+ n.+] [Nat n/- n.-] diff --git a/stdlib/source/documentation/lux/control/function.lux b/stdlib/source/documentation/lux/control/function.lux index 4d73ff69b..ed276e3f4 100644 --- a/stdlib/source/documentation/lux/control/function.lux +++ b/stdlib/source/documentation/lux/control/function.lux @@ -13,7 +13,8 @@ ["[1][0]" contract] ["[1][0]" memo] ["[1][0]" mixin] - ["[1][0]" mutual]]) + ["[1][0]" mutual] + ["[1][0]" predicate]]) (.def .public documentation (.List $.Module) @@ -48,4 +49,5 @@ [/contract.documentation /memo.documentation /mixin.documentation - /mutual.documentation])) + /mutual.documentation + /predicate.documentation])) diff --git a/stdlib/source/documentation/lux/control/function/predicate.lux b/stdlib/source/documentation/lux/control/function/predicate.lux new file mode 100644 index 000000000..e8507ce02 --- /dev/null +++ b/stdlib/source/documentation/lux/control/function/predicate.lux @@ -0,0 +1,42 @@ +(.require + [library + [lux + ["$" documentation] + [data + [text (.only \n) + ["%" \\format (.only format)]]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.union) + ($.default /.intersection) + ($.default /.functor) + + ($.documentation (/.Predicate it) + "A question that can be asked of a value, yield either false (#0) or true (#1).") + + ($.documentation /.none + "A predicate that always fails.") + + ($.documentation /.or + "A predicate that meets either predecessor.") + + ($.documentation /.all + "A predicate that always succeeds.") + + ($.documentation /.and + "A predicate that meets both predecessors.") + + ($.documentation /.complement + "The opposite of a predicate.") + + ($.documentation /.difference + "A predicate that meeds 'base', but not 'sub'.") + + ($.documentation /.rec + "Ties the knot for a recursive predicate.")] + [])) diff --git a/stdlib/source/documentation/lux/control/parser/analysis.lux b/stdlib/source/documentation/lux/control/parser/analysis.lux index d0f1d3012..14ff24f04 100644 --- a/stdlib/source/documentation/lux/control/parser/analysis.lux +++ b/stdlib/source/documentation/lux/control/parser/analysis.lux @@ -28,9 +28,9 @@ (with_template [ ] [(`` (these (`` (documentation: - (format "Queries for a " (~~ (template.text [])) " value."))) + (format "Queries for a " (,, (template.text [])) " value."))) (`` (documentation: - (format "Assert a specific " (~~ (template.text [])) " value.")))))] + (format "Assert a specific " (,, (template.text [])) " value.")))))] [/.bit /.this_bit] [/.nat /.this_nat] diff --git a/stdlib/source/documentation/lux/control/parser/code.lux b/stdlib/source/documentation/lux/control/parser/code.lux index e4b75bce8..0840fd16d 100644 --- a/stdlib/source/documentation/lux/control/parser/code.lux +++ b/stdlib/source/documentation/lux/control/parser/code.lux @@ -18,9 +18,9 @@ (with_template [ ] [(`` (documentation: - (format "Parses the next " (~~ (template.text [])) " input."))) + (format "Parses the next " (,, (template.text [])) " input."))) (`` (documentation: - (format "Checks for a specific " (~~ (template.text [])) " input.")))] + (format "Checks for a specific " (,, (template.text [])) " input.")))] [/.bit /.this_bit] [/.nat /.this_nat] @@ -46,7 +46,7 @@ (with_template [] [(`` (documentation: - (format "Parses the contents of a " (~~ (template.text [])) ".")))] + (format "Parses the contents of a " (,, (template.text [])) ".")))] [/.form] [/.variant] diff --git a/stdlib/source/documentation/lux/control/parser/json.lux b/stdlib/source/documentation/lux/control/parser/json.lux index af4d3ed00..ed4068800 100644 --- a/stdlib/source/documentation/lux/control/parser/json.lux +++ b/stdlib/source/documentation/lux/control/parser/json.lux @@ -23,7 +23,7 @@ (with_template [] [(`` (documentation: - (format "Reads a JSON value as " (~~ (template.text [])) ".")))] + (format "Reads a JSON value as " (,, (template.text [])) ".")))] [/.null] [/.boolean] @@ -33,9 +33,9 @@ (with_template [ ] [(`` (documentation: - (format "Asks whether a JSON value is a " (~~ (template.text [])) "."))) + (format "Asks whether a JSON value is a " (,, (template.text [])) "."))) (`` (documentation: - (format "Ensures a JSON value is a " (~~ (template.text [])) ".")))] + (format "Ensures a JSON value is a " (,, (template.text [])) ".")))] [/.boolean? /.this_boolean ..boolean] [/.number? /.this_number ..number] diff --git a/stdlib/source/documentation/lux/control/parser/synthesis.lux b/stdlib/source/documentation/lux/control/parser/synthesis.lux index f0187c4f7..b55bb6061 100644 --- a/stdlib/source/documentation/lux/control/parser/synthesis.lux +++ b/stdlib/source/documentation/lux/control/parser/synthesis.lux @@ -29,9 +29,9 @@ (with_template [ ] [(`` (documentation: - (format "Queries for a " (~~ (template.text [])) " synthesis node."))) + (format "Queries for a " (,, (template.text [])) " synthesis node."))) (`` (documentation: - (format "Checks for a specific " (~~ (template.text [])) " synthesis node.")))] + (format "Checks for a specific " (,, (template.text [])) " synthesis node.")))] [/.bit /.this_bit] [/.i64 /.this_i64] diff --git a/stdlib/source/documentation/lux/control/parser/text.lux b/stdlib/source/documentation/lux/control/parser/text.lux index 7e13643b1..4b35bc626 100644 --- a/stdlib/source/documentation/lux/control/parser/text.lux +++ b/stdlib/source/documentation/lux/control/parser/text.lux @@ -35,7 +35,7 @@ (with_template [ ] [(`` (documentation: - (format "Produce a character" (~~ (template.text [])) " if the parser fails.")))] + (format "Produce a character" (,, (template.text [])) " if the parser fails.")))] [/.not ""] [/.not! " (as a slice)"] @@ -110,9 +110,9 @@ (with_template [ ] [(`` (documentation: - (format "Yields " (~~ (template.text [])) " characters as a single continuous text."))) + (format "Yields " (,, (template.text [])) " characters as a single continuous text."))) (`` (documentation: - (format "Yields " (~~ (template.text [])) " characters as a single continuous text (as a slice).")))] + (format "Yields " (,, (template.text [])) " characters as a single continuous text (as a slice).")))] [/.some /.some!] [/.many /.many!] diff --git a/stdlib/source/documentation/lux/control/parser/type.lux b/stdlib/source/documentation/lux/control/parser/type.lux index 52e9a0fbb..171db7456 100644 --- a/stdlib/source/documentation/lux/control/parser/type.lux +++ b/stdlib/source/documentation/lux/control/parser/type.lux @@ -43,7 +43,7 @@ (with_template [] [(`` (documentation: - (format "Parses the contents of a " (~~ (template.text [])) " type.")))] + (format "Parses the contents of a " (,, (template.text [])) " type.")))] [/.variant] [/.tuple] diff --git a/stdlib/source/documentation/lux/control/security/capability.lux b/stdlib/source/documentation/lux/control/security/capability.lux index ba9e3a80a..920f9c439 100644 --- a/stdlib/source/documentation/lux/control/security/capability.lux +++ b/stdlib/source/documentation/lux/control/security/capability.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text (.only \n) ["%" \\format (.only format)]]] @@ -10,35 +10,30 @@ [\\library ["[0]" /]]) -(documentation: (/.Capability brand input output) - (format "Represents the capability to perform an operation." - \n "This operation is assumed to have security implications.")) - -(documentation: /.use - "Applies a capability against its required input." - [(use capability input)]) - -(documentation: /.capability: - "Defines a capability as a unique type, and a constructor for instances." - [(capability: (Can_Duplicate a) - (can_duplicate a [a a])) - - (let [capability (can_duplicate - (function (_ value) - [value value])) - [left right] (..use capability 123)] - (same? left right))]) - -(documentation: /.async - "Converts a synchronous I/O-based capability into an asynchronous capability." - [(async capability)]) - (.def .public documentation (.List $.Module) ($.module /._ "" - [..Capability - ..use - ..capability: - ..async] + [($.documentation (/.Capability brand input output) + (format "Represents the capability to perform an operation." + \n "This operation is assumed to have security implications.")) + + ($.documentation /.use + "Applies a capability against its required input." + [(use capability input)]) + + ($.documentation /.capability: + "Defines a capability as a unique type, and a constructor for instances." + [(capability: (Can_Duplicate a) + (can_duplicate a [a a])) + + (let [capability (can_duplicate + (function (_ value) + [value value])) + [left right] (..use capability 123)] + (same? left right))]) + + ($.documentation /.async + "Converts a synchronous I/O-based capability into an asynchronous capability." + [(async capability)])] [])) diff --git a/stdlib/source/documentation/lux/control/security/policy.lux b/stdlib/source/documentation/lux/control/security/policy.lux index a2da0b92f..d693c8c50 100644 --- a/stdlib/source/documentation/lux/control/security/policy.lux +++ b/stdlib/source/documentation/lux/control/security/policy.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text (.only \n) ["%" \\format (.only format)]]] @@ -10,81 +10,71 @@ [\\library ["[0]" /]]) -(documentation: (/.Policy brand value %) - "A security policy encoded as the means to 'upgrade' or 'downgrade' in a secure context.") +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.functor) + ($.default /.apply) + ($.default /.monad) + ($.default /.Private) + ($.default /.Can_Conceal) + ($.default /.Can_Reveal) + ($.default /.Safe) + ($.default /.Can_Trust) + ($.default /.Can_Distrust) -(documentation: (/.Can_Upgrade brand % value) - "Represents the capacity to 'upgrade' a value.") + ($.documentation (/.Policy brand value %) + "A security policy encoded as the means to 'upgrade' or 'downgrade' in a secure context.") -(documentation: (/.Can_Downgrade brand % value) - "Represents the capacity to 'downgrade' a value.") + ($.documentation (/.Can_Upgrade brand % value) + "Represents the capacity to 'upgrade' a value.") -(documentation: (/.Privilege brand %) - "Represents the privilege to both 'upgrade' and 'downgrade' a value.") + ($.documentation (/.Can_Downgrade brand % value) + "Represents the capacity to 'downgrade' a value.") -(documentation: (/.Delegation brand %from %to) - "Represents the act of delegating policy capacities.") + ($.documentation (/.Privilege brand %) + "Represents the privilege to both 'upgrade' and 'downgrade' a value.") -(documentation: /.delegation - "Delegating policy capacities." - [(delegation downgrade upgrade)]) + ($.documentation (/.Delegation brand %from %to) + "Represents the act of delegating policy capacities.") -(documentation: (/.Context brand scope %) - "A computational context with an associated policy privilege.") + ($.documentation /.delegation + "Delegating policy capacities." + [(delegation downgrade upgrade)]) -(documentation: /.with_policy - "Activates a security context with the priviledge to enforce it's policy." - [(type Password - (Private Text)) + ($.documentation (/.Context brand scope %) + "A computational context with an associated policy privilege.") - (type (Policy %) - (Interface - (is (-> Text (Password %)) - password) - (is (-> (Password %) Text) - unsafe))) + ($.documentation /.with_policy + "Activates a security context with the priviledge to enforce it's policy." + [(type Password + (Private Text)) - (def (policy _) - (Ex (_ %) (-> Any (Policy %))) - (with_policy - (is (Context Privacy Policy) - (function (_ (open "%::.")) - (implementation - (def (password value) - (%::can_upgrade value)) - (def (unsafe password) - (%::can_downgrade password)))))))] - [(with_policy context)]) + (type (Policy %) + (Interface + (is (-> Text (Password %)) + password) + (is (-> (Password %) Text) + unsafe))) -(documentation: /.Privacy - (format "A security context for privacy." - \n "Private data is data which cannot be allowed to leak outside of the programmed.")) + (def (policy _) + (Ex (_ %) (-> Any (Policy %))) + (with_policy + (is (Context Privacy Policy) + (function (_ (open "%::.")) + (implementation + (def (password value) + (%::can_upgrade value)) + (def (unsafe password) + (%::can_downgrade password)))))))] + [(with_policy context)]) -(documentation: /.Safety - (format "A security context for safety." - \n "Safe data is data coming from outside the program which can be trusted to be properly formatted and lacking injections.")) + ($.documentation /.Privacy + (format "A security context for privacy." + \n "Private data is data which cannot be allowed to leak outside of the programmed.")) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [..Policy - ..Can_Upgrade - ..Can_Downgrade - ..Privilege - ..Delegation - ..delegation - ..Context - ..with_policy - ..Privacy - ..Safety - ($.default /.functor) - ($.default /.apply) - ($.default /.monad) - ($.default /.Private) - ($.default /.Can_Conceal) - ($.default /.Can_Reveal) - ($.default /.Safe) - ($.default /.Can_Trust) - ($.default /.Can_Distrust)] + ($.documentation /.Safety + (format "A security context for safety." + \n "Safe data is data coming from outside the program which can be trusted to be properly formatted and lacking injections."))] [])) diff --git a/stdlib/source/documentation/lux/data/collection/array.lux b/stdlib/source/documentation/lux/data/collection/array.lux index b6bc74a63..29416d649 100644 --- a/stdlib/source/documentation/lux/data/collection/array.lux +++ b/stdlib/source/documentation/lux/data/collection/array.lux @@ -6,8 +6,9 @@ ["[0]" text (.only \n) ["%" \\format (.only format)]]] [macro - ["[0]" code] - ["[0]" template]]]] + ["[0]" template]] + [meta + ["[0]" code]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/documentation/lux/data/collection/bits.lux b/stdlib/source/documentation/lux/data/collection/bits.lux index 55d0354b0..522f7eccd 100644 --- a/stdlib/source/documentation/lux/data/collection/bits.lux +++ b/stdlib/source/documentation/lux/data/collection/bits.lux @@ -1,13 +1,7 @@ (.require [library - [lux (.except or and not) - ["$" documentation] - [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" code] - ["[0]" template]]]] + [lux (.except) + ["$" documentation]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/documentation/lux/data/collection/dictionary.lux b/stdlib/source/documentation/lux/data/collection/dictionary.lux index 342d79f15..99f6342b4 100644 --- a/stdlib/source/documentation/lux/data/collection/dictionary.lux +++ b/stdlib/source/documentation/lux/data/collection/dictionary.lux @@ -1,13 +1,10 @@ (.require [library - [lux (.except has revised) + [lux (.except) ["$" documentation] [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" code] - ["[0]" template]]]] + [text (.only \n) + ["%" \\format (.only format)]]]]] [\\library ["[0]" /]] ["[0]" / diff --git a/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux index a946434d6..74381c580 100644 --- a/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux @@ -3,10 +3,9 @@ [lux (.except has revised) ["$" documentation] [data - ["[0]" text (.only \n) + [text ["%" \\format (.only format)]]] [macro - ["[0]" code] ["[0]" template]]]] [\\library ["[0]" /]]) @@ -36,9 +35,9 @@ "" [(key? dict key)]) - (~~ (with_template [] + (,, (with_template [] [(`` ($.documentation - (format "Yields value under the " (~~ (template.text [])) "imum key.")))] + (format "Yields value under the " (,, (template.text [])) "imum key.")))] [/.min] [/.max] diff --git a/stdlib/source/documentation/lux/data/collection/list.lux b/stdlib/source/documentation/lux/data/collection/list.lux index d3fb2c080..60c60b480 100644 --- a/stdlib/source/documentation/lux/data/collection/list.lux +++ b/stdlib/source/documentation/lux/data/collection/list.lux @@ -3,11 +3,8 @@ [lux (.except all) ["$" documentation] [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" code] - ["[0]" template]]]] + [text (.only \n) + ["%" \\format (.only format)]]]]] [\\library ["[0]" /]] ["[0]" / @@ -111,7 +108,7 @@ "" [(member? eq xs x)]) - (~~ (with_template [ ] + (,, (with_template [ ] [($.documentation )] diff --git a/stdlib/source/documentation/lux/data/collection/list/property.lux b/stdlib/source/documentation/lux/data/collection/list/property.lux index 99e2faf06..b94d44263 100644 --- a/stdlib/source/documentation/lux/data/collection/list/property.lux +++ b/stdlib/source/documentation/lux/data/collection/list/property.lux @@ -1,13 +1,10 @@ (.require [library - [lux (.except has revised) + [lux (.except) ["$" documentation] [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" code] - ["[0]" template]]]] + [text (.only \n) + ["%" \\format (.only format)]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/documentation/lux/data/collection/queue.lux b/stdlib/source/documentation/lux/data/collection/queue.lux index 963776aa5..935b0dfc3 100644 --- a/stdlib/source/documentation/lux/data/collection/queue.lux +++ b/stdlib/source/documentation/lux/data/collection/queue.lux @@ -1,13 +1,7 @@ (.require [library [lux (.except list) - ["$" documentation] - [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" code] - ["[0]" template]]]] + ["$" documentation]]] [\\library ["[0]" /]] ["[0]" / diff --git a/stdlib/source/documentation/lux/data/collection/queue/priority.lux b/stdlib/source/documentation/lux/data/collection/queue/priority.lux index 4952a6954..4c6303902 100644 --- a/stdlib/source/documentation/lux/data/collection/queue/priority.lux +++ b/stdlib/source/documentation/lux/data/collection/queue/priority.lux @@ -1,13 +1,7 @@ (.require [library [lux (.except list) - ["$" documentation] - [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" code] - ["[0]" template]]]] + ["$" documentation]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/documentation/lux/data/collection/sequence.lux b/stdlib/source/documentation/lux/data/collection/sequence.lux index 283eca310..9bc09f736 100644 --- a/stdlib/source/documentation/lux/data/collection/sequence.lux +++ b/stdlib/source/documentation/lux/data/collection/sequence.lux @@ -1,13 +1,7 @@ (.require [library [lux (.except list has revised) - ["$" documentation] - [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" code] - ["[0]" template]]]] + ["$" documentation]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/documentation/lux/data/collection/stream.lux b/stdlib/source/documentation/lux/data/collection/stream.lux index 5a5021150..393765c2f 100644 --- a/stdlib/source/documentation/lux/data/collection/stream.lux +++ b/stdlib/source/documentation/lux/data/collection/stream.lux @@ -3,11 +3,8 @@ [lux (.except list pattern) ["$" documentation] [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" code] - ["[0]" template]]]] + [text (.only \n) + ["%" \\format (.only format)]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/documentation/lux/data/color.lux b/stdlib/source/documentation/lux/data/color.lux index fade67993..c76cf4c45 100644 --- a/stdlib/source/documentation/lux/data/color.lux +++ b/stdlib/source/documentation/lux/data/color.lux @@ -7,7 +7,8 @@ ["%" \\format (.only format)]]] [macro [syntax (.only syntax)] - ["[0]" template] + ["[0]" template]] + [meta ["[0]" code (.only) ["<[1]>" \\parser]]]]] [\\library @@ -91,10 +92,10 @@ ($.documentation /.Pigment "A color with some degree of transparency.") - (~~ (with_template [] + (,, (with_template [] [(`` ($.documentation (format "A " - (text.replaced "_" "-" (~~ (template.text []))) + (text.replaced "_" "-" (,, (template.text []))) " color scheme.")))] [/.triad] diff --git a/stdlib/source/documentation/lux/data/color/named.lux b/stdlib/source/documentation/lux/data/color/named.lux index 94f5df07b..f7da245b1 100644 --- a/stdlib/source/documentation/lux/data/color/named.lux +++ b/stdlib/source/documentation/lux/data/color/named.lux @@ -5,9 +5,6 @@ [data ["[0]" text (.only) ["%" \\format (.only format)]]] - [macro - ["[0]" code] - ["[0]" template]] [math [number ["[0]" nat (.use "hex#[0]" hex)]]]]] @@ -19,7 +16,7 @@ (.List $.Module) ($.module /._ "" - [(~~ (with_template [] + [(,, (with_template [] [($.documentation (let [[red green blue] (//.rgb ) [_ name] (symbol )] diff --git a/stdlib/source/documentation/lux/data/format/json.lux b/stdlib/source/documentation/lux/data/format/json.lux index 2051ee55c..ccf18365e 100644 --- a/stdlib/source/documentation/lux/data/format/json.lux +++ b/stdlib/source/documentation/lux/data/format/json.lux @@ -55,7 +55,7 @@ "A JSON object field setter." [(has key value json)]) - (~~ (with_template [ ] + (,, (with_template [ ] [($.documentation (format "A JSON object field getter for " "."))] diff --git a/stdlib/source/documentation/lux/data/text/encoding.lux b/stdlib/source/documentation/lux/data/text/encoding.lux index 6a8652b67..42b3ff87e 100644 --- a/stdlib/source/documentation/lux/data/text/encoding.lux +++ b/stdlib/source/documentation/lux/data/text/encoding.lux @@ -21,7 +21,7 @@ ($.documentation /.Encoding "Encoding formats for text.") - (~~ (with_template [] + (,, (with_template [] [($.documentation (format "'" (/.name ) "' text encoding. "))] diff --git a/stdlib/source/documentation/lux/data/text/unicode/block.lux b/stdlib/source/documentation/lux/data/text/unicode/block.lux index 0ee609dd9..2021ce0d1 100644 --- a/stdlib/source/documentation/lux/data/text/unicode/block.lux +++ b/stdlib/source/documentation/lux/data/text/unicode/block.lux @@ -35,7 +35,7 @@ "" [(within? block char)]) - (~~ (with_template [] + (,, (with_template [] [($.documentation (let [[_ name] (symbol )] (format (hex#encoded (/.start )) diff --git a/stdlib/source/documentation/lux/extension.lux b/stdlib/source/documentation/lux/extension.lux index 729abbec5..35b5fbd72 100644 --- a/stdlib/source/documentation/lux/extension.lux +++ b/stdlib/source/documentation/lux/extension.lux @@ -9,7 +9,8 @@ [collection ["[0]" sequence]]] [macro - ["[0]" template] + ["[0]" template]] + [meta ["[0]" code ["<[1]>" \\parser]]] [tool diff --git a/stdlib/source/documentation/lux/ffi.jvm.lux b/stdlib/source/documentation/lux/ffi.jvm.lux index 436c252b6..760a625f0 100644 --- a/stdlib/source/documentation/lux/ffi.jvm.lux +++ b/stdlib/source/documentation/lux/ffi.jvm.lux @@ -22,9 +22,9 @@ ($.default /.cannot_convert_to_jvm_type) ($.default /.cannot_cast_to_non_object) - (~~ (with_template [] + (,, (with_template [] [(`` ($.documentation - (format "The type of a (boxed) " (~~ (template.text [])) " object.")))] + (format "The type of a (boxed) " (,, (template.text [])) " object.")))] [/.Boolean] [/.Byte] @@ -36,9 +36,9 @@ [/.Character] )) - (~~ (with_template [] + (,, (with_template [] [(`` ($.documentation - (format "The type of an (unboxed) " (~~ (template.text [])) " value.")))] + (format "The type of an (unboxed) " (,, (template.text [])) " value.")))] [/.boolean] [/.byte] @@ -50,7 +50,7 @@ [/.char] )) - (~~ (with_template [ ] + (,, (with_template [ ] [(`` ($.documentation "Type converter."))] diff --git a/stdlib/source/documentation/lux/ffi.old.lux b/stdlib/source/documentation/lux/ffi.old.lux index 460e8512e..ce7eb423e 100644 --- a/stdlib/source/documentation/lux/ffi.old.lux +++ b/stdlib/source/documentation/lux/ffi.old.lux @@ -18,7 +18,7 @@ ($.default /.State) ($.default /.Inheritance) - (~~ (with_template [ ] + (,, (with_template [ ] [($.documentation "Type converter.")] diff --git a/stdlib/source/documentation/lux/macro.lux b/stdlib/source/documentation/lux/macro.lux index 7e6c34963..da66da131 100644 --- a/stdlib/source/documentation/lux/macro.lux +++ b/stdlib/source/documentation/lux/macro.lux @@ -8,7 +8,6 @@ [collection ["[0]" list]]]]] ["[0]" / - ["[1][0]" code] ["[1][0]" local] ["[1][0]" syntax] ["[1][0]" template]] @@ -47,11 +46,11 @@ (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))))))))]) + (in (list (` (let [(, g!lock) (, lock) + (, g!_) ("jvm monitorenter" (, g!lock)) + (, g!body) (, body) + (, g!_) ("jvm monitorexit" (, g!lock))] + (, g!body))))))))]) ($.documentation /.one_expansion "Works just like expand, except that it ensures that the output is a single Code token." @@ -95,7 +94,6 @@ (def (foo bar baz) (-> Int Int Int) (int.+ bar baz)))])] - [/code.documentation - /local.documentation + [/local.documentation /syntax.documentation /template.documentation])) diff --git a/stdlib/source/documentation/lux/macro/syntax.lux b/stdlib/source/documentation/lux/macro/syntax.lux index fc7675a8c..30dd6b08a 100644 --- a/stdlib/source/documentation/lux/macro/syntax.lux +++ b/stdlib/source/documentation/lux/macro/syntax.lux @@ -39,7 +39,7 @@ (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)))))))))])] + (in (list (` ((, (code.text def_code)))))))))])] [/check.documentation /declaration.documentation /definition.documentation diff --git a/stdlib/source/documentation/lux/math/number.lux b/stdlib/source/documentation/lux/math/number.lux index c63a71371..2420d347a 100644 --- a/stdlib/source/documentation/lux/math/number.lux +++ b/stdlib/source/documentation/lux/math/number.lux @@ -25,7 +25,7 @@ (.List $.Module) ($.module /._ "" - [(~~ (with_template [ ] + [(,, (with_template [ ] [($.documentation (format "Given syntax for a " " number, generates a Nat, an Int, a Rev or a Frac.") [] diff --git a/stdlib/source/documentation/lux/math/number/frac.lux b/stdlib/source/documentation/lux/math/number/frac.lux index 9fd4f06ce..8ae35ef2e 100644 --- a/stdlib/source/documentation/lux/math/number/frac.lux +++ b/stdlib/source/documentation/lux/math/number/frac.lux @@ -88,7 +88,7 @@ "Frac(tion) greater-than or equal." [(>= reference sample)]) - (~~ (with_template [ ] + (,, (with_template [ ] [($.documentation )] @@ -103,7 +103,7 @@ "" [(/% param subject)]) - (~~ (with_template [ ] + (,, (with_template [ ] [($.documentation )] @@ -111,7 +111,7 @@ [/.max "Frac(tion) minimum."] )) - (~~ (with_template [ ] + (,, (with_template [ ] [($.documentation )] diff --git a/stdlib/source/documentation/lux/math/number/i64.lux b/stdlib/source/documentation/lux/math/number/i64.lux index b11806f7d..0a6cef889 100644 --- a/stdlib/source/documentation/lux/math/number/i64.lux +++ b/stdlib/source/documentation/lux/math/number/i64.lux @@ -27,7 +27,7 @@ ($.default /.left_rotated) ($.default /.right_rotated) - (~~ (with_template [ ] + (,, (with_template [ ] [($.documentation )] @@ -60,7 +60,7 @@ "Count the number of 1s in a bit-map." [(ones it)]) - (~~ (with_template [ ] + (,, (with_template [ ] [($.documentation )] diff --git a/stdlib/source/documentation/lux/math/number/int.lux b/stdlib/source/documentation/lux/math/number/int.lux index 088f8e87f..70cec4be4 100644 --- a/stdlib/source/documentation/lux/math/number/int.lux +++ b/stdlib/source/documentation/lux/math/number/int.lux @@ -55,7 +55,7 @@ "Int(eger) greater-than or equal." [(>= reference sample)]) - (~~ (with_template [ ] + (,, (with_template [ ] [($.documentation )] @@ -63,7 +63,7 @@ [/.max "Int(eger) maximum."] )) - (~~ (with_template [ ] + (,, (with_template [ ] [($.documentation )] diff --git a/stdlib/source/documentation/lux/math/number/nat.lux b/stdlib/source/documentation/lux/math/number/nat.lux index 5bf379bba..62c72b8b8 100644 --- a/stdlib/source/documentation/lux/math/number/nat.lux +++ b/stdlib/source/documentation/lux/math/number/nat.lux @@ -32,7 +32,7 @@ ($.default /.decimal) ($.default /.hash) - (~~ (with_template [ ] + (,, (with_template [ ] [($.documentation )] @@ -49,7 +49,7 @@ [/.% "Nat(ural) remainder."] )) - (~~ (with_template [ ] + (,, (with_template [ ] [($.documentation )] diff --git a/stdlib/source/documentation/lux/math/number/rev.lux b/stdlib/source/documentation/lux/math/number/rev.lux index 5450725b8..d93c8e3c5 100644 --- a/stdlib/source/documentation/lux/math/number/rev.lux +++ b/stdlib/source/documentation/lux/math/number/rev.lux @@ -62,7 +62,7 @@ "Rev(olution) greater-than or equal." [(>= reference sample)]) - (~~ (with_template [ ] + (,, (with_template [ ] [($.documentation )] @@ -70,7 +70,7 @@ [/.max "Rev(olution) maximum."] )) - (~~ (with_template [ ] + (,, (with_template [ ] [($.documentation )] diff --git a/stdlib/source/documentation/lux/meta.lux b/stdlib/source/documentation/lux/meta.lux index dfe0b27bd..72315f3d2 100644 --- a/stdlib/source/documentation/lux/meta.lux +++ b/stdlib/source/documentation/lux/meta.lux @@ -10,8 +10,10 @@ [\\library ["[0]" /]] ["[0]" / + ["[1][0]" code] ["[1][0]" location] - ["[1][0]" symbol]]) + ["[1][0]" symbol] + ["[1][0]" type]]) (.def .public documentation (.List $.Module) @@ -162,5 +164,7 @@ ($.documentation /.eval "" [(eval type code)])] - [/location.documentation - /symbol.documentation])) + [/code.documentation + /location.documentation + /symbol.documentation + /type.documentation])) diff --git a/stdlib/source/documentation/lux/meta/type.lux b/stdlib/source/documentation/lux/meta/type.lux new file mode 100644 index 000000000..e4b93f034 --- /dev/null +++ b/stdlib/source/documentation/lux/meta/type.lux @@ -0,0 +1,167 @@ +(.require + [library + [lux (.except function as let) + ["$" documentation] + [data + ["[0]" text (.only \n) + ["%" \\format]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]] + ["[0]" / + ["[1][0]" primitive] + ["[1][0]" check] + ["[1][0]" dynamic] + ["[1][0]" implicit] + ["[1][0]" poly] + ["[1][0]" quotient] + ["[1][0]" refinement] + ["[1][0]" resource] + ["[1][0]" unit] + ["[1][0]" variance]]) + +(`` (.def .public documentation + (.List $.Module) + ($.module /._ + "Basic functionality for working with types." + [($.default /.equivalence) + + (,, (with_template [] + [($.documentation + "The number of parameters, and the body, of a quantified type.")] + + [/.flat_univ_q] + [/.flat_ex_q] + )) + + ($.documentation /.flat_function + "The input, and the output of a function type." + [(flat_function type)]) + + ($.documentation /.flat_application + "The quantified type, and its parameters, for a type-application." + [(flat_application type)]) + + (,, (with_template [] + [($.documentation + "The members of a composite type.")] + + [/.flat_variant] + [/.flat_tuple] + )) + + ($.documentation /.format + "A (readable) textual representable of a type." + [(format type)]) + + ($.documentation /.applied + "To the extend possible, applies a quantified type to the given parameters." + [(applied params func)]) + + ($.documentation /.code + (%.format "A representation of a type as code." + \n "The code is such that evaluating it would yield the type value.") + [(code type)]) + + ($.documentation /.de_aliased + "A (potentially named) type that does not have its name shadowed by other names." + [(de_aliased type)]) + + ($.documentation /.anonymous + "A type without any names covering it." + [(anonymous type)]) + + (,, (with_template [] + [($.documentation + "A composite type, constituted by the given member types.")] + + [/.variant] + [/.tuple] + )) + + ($.documentation /.function + "A function type, with the given inputs and output." + [(function inputs output)]) + + ($.documentation /.application + "An un-evaluated type application, with the given quantified type, and parameters." + [(application params quant)]) + + (,, (with_template [] + [($.documentation + "A quantified type, with the given number of parameters, and body.")] + + [/.univ_q] + [/.ex_q] + )) + + ($.documentation /.quantified? + "Only yields #1 for universally or existentially quantified types." + [(quantified? type)]) + + ($.documentation /.array + "An array type, with the given level of nesting/depth, and the given element type." + [(array depth element_type)]) + + ($.documentation /.flat_array + "The level of nesting/depth and element type for an array type." + [(flat_array type)]) + + ($.documentation /.array? + "Is a type an array type?") + + ($.documentation /.log! + "Logs to the console/terminal the type of an expression." + [(log! (is Foo (foo expression))) + "=>" + "Expression: (foo expression)" + " Type: Foo" + (foo expression)]) + + ($.documentation /.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))))]) + + ($.documentation /.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))))]) + + ($.documentation /.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))]) + + ($.documentation /.let + "Local bindings for types." + [(let [side (Either Int Frac)] + (List [side side]))])] + [/primitive.documentation + /check.documentation + /dynamic.documentation + /implicit.documentation + /poly.documentation + /quotient.documentation + /refinement.documentation + /resource.documentation + /unit.documentation + /variance.documentation]))) diff --git a/stdlib/source/documentation/lux/meta/type/check.lux b/stdlib/source/documentation/lux/meta/type/check.lux new file mode 100644 index 000000000..e5a7130cf --- /dev/null +++ b/stdlib/source/documentation/lux/meta/type/check.lux @@ -0,0 +1,79 @@ +(.require + [library + [lux (.except and) + ["$" documentation] + [data + ["[0]" text (.only \n) + ["%" \\format (.only format)]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "Type-checking functionality." + [($.default /.unknown_type_var) + ($.default /.unbound_type_var) + ($.default /.invalid_type_application) + ($.default /.cannot_rebind_var) + ($.default /.type_check_failed) + ($.default /.functor) + ($.default /.apply) + ($.default /.monad) + ($.default /.bound?) + ($.default /.peek) + ($.default /.read) + + ($.documentation /.Var + "The ID for a type-variable in a type-checking context.") + + ($.documentation (/.Check it) + "A type-checking computation which may fail or yield a value.") + + ($.documentation /.result + "" + [(result context proc)]) + + ($.documentation /.failure + "" + [(failure message)]) + + ($.documentation /.assertion + "" + [(assertion message test)]) + + ($.documentation /.except + "" + [(except exception message)]) + + ($.documentation /.existential + "A brand-new existential type.") + + ($.documentation /.bind + (format "Attemmpts to buy a type-variable." + \n "Fails if the variable has been bound already.") + [(bind type id)]) + + ($.documentation /.var + "A brand-new (unbound) type-variable.") + + ($.documentation /.fresh_context + "An empty/un-used type-checking context.") + + ($.documentation /.check + "Type-check to ensure that the 'expected' type subsumes the 'actual' type." + [(check expected actual)]) + + ($.documentation /.subsumes? + "A simple type-checking function that just returns a yes/no answer." + [(subsumes? expected actual)]) + + ($.documentation /.context + "The current state of the type-checking context.") + + ($.documentation /.clean + "Resolves every bound type-variable to yield a new type that is as resolved as possible." + [(clean inputT)])] + [])) diff --git a/stdlib/source/documentation/lux/meta/type/dynamic.lux b/stdlib/source/documentation/lux/meta/type/dynamic.lux new file mode 100644 index 000000000..861d7143f --- /dev/null +++ b/stdlib/source/documentation/lux/meta/type/dynamic.lux @@ -0,0 +1,32 @@ +(.require + [library + [lux (.except static) + ["$" documentation] + [data + ["[0]" text (.only \n) + ["%" \\format (.only format)]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.wrong_type) + ($.default /.format) + + ($.documentation /.Dynamic + "A value coupled with its type, so it can be checked later.") + + ($.documentation /.dynamic + "" + [(is Dynamic + (dynamic 123))]) + + ($.documentation /.static + "" + [(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 new file mode 100644 index 000000000..9490d4aee --- /dev/null +++ b/stdlib/source/documentation/lux/meta/type/implicit.lux @@ -0,0 +1,53 @@ +(.require + [library + [lux (.except and) + ["$" documentation] + [data + ["[0]" text (.only \n) + ["%" \\format (.only format)]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.documentation /.a/an + (format "Automatic implementation selection (for type-class style polymorphism)." + \n "This feature layers type-class style polymorphism on top of Lux's signatures and implementations." + \n "When calling a polymorphic function, or using a polymorphic constant," + \n "this macro will check the types of the arguments, and the expected type for the whole expression" + \n "and it will search in the local scope, the module's scope and the imports' scope" + \n "in order to find suitable implementations to satisfy those requirements." + \n "If a single alternative is found, that one will be used automatically." + \n "If no alternative is found, or if more than one alternative is found (ambiguity)" + \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))]) + + ($.documentation /.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)))]) + + ($.documentation /.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))])] + [])) diff --git a/stdlib/source/documentation/lux/meta/type/poly.lux b/stdlib/source/documentation/lux/meta/type/poly.lux new file mode 100644 index 000000000..979ae2899 --- /dev/null +++ b/stdlib/source/documentation/lux/meta/type/poly.lux @@ -0,0 +1,26 @@ +(.require + [library + [lux (.except and) + ["$" documentation] + [abstract + [\\specification + ["$[0]" equivalence] + ["$[0]" codec]]] + [data + ["[0]" text (.only \n) + ["%" \\format (.only format)]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.polytypic) + + ($.documentation /.code + "" + [(code env type)])] + [])) diff --git a/stdlib/source/documentation/lux/meta/type/primitive.lux b/stdlib/source/documentation/lux/meta/type/primitive.lux new file mode 100644 index 000000000..d531ffb98 --- /dev/null +++ b/stdlib/source/documentation/lux/meta/type/primitive.lux @@ -0,0 +1,120 @@ +(.require + [library + [lux (.except) + ["$" documentation] + [data + ["[0]" text (.only \n) + ["%" \\format (.only format)]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) + +(`` (.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.documentation /.Frame + "Meta-data about an abstract/nominal type in a stack of them.") + + ($.documentation /.current + "The currently-being-defined abstract/nominal type.") + + ($.documentation /.specific + "A specific abstract/nominal type still being defined somewhere in the scope." + [(specific name)]) + + (,, (with_template [ <$> ] + [($.documentation + "Type-casting macro for abstract/nominal types." + [(|> value + (is ) + <$> + (is ))])] + + [/.abstraction Representation abstraction Abstraction] + [/.representation Abstraction representation Representation] + )) + + ($.documentation /.primitive + (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.") + [(primitive String + Text + + (def (string value) + (-> Text String) + (abstraction value)) + + (def (text value) + (-> String Text) + (representation value)))] + ["Type-parameters are optional." + (primitive (Duplicate a) + [a a] + + (def (duplicate value) + (All (_ a) (-> a (Duplicate a))) + (abstraction [value value])))] + ["Definitions can be nested." + (primitive (Single a) + a + + (def (single value) + (All (_ a) (-> a (Single a))) + (abstraction value)) + + (primitive (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." + (primitive (JavaScript a) + Text + + (primitive Expression Any) + (primitive 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) + "}"))))]) + + ($.documentation /.transmutation + "Transmutes an abstract/nominal type's phantom types." + [(primitive (JavaScript a) + Text + + (primitive Expression Any) + (primitive Statement Any) + + (def (statement expression) + (-> (JavaScript Expression) (JavaScript Statement)) + (transmutation 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 new file mode 100644 index 000000000..1451674e6 --- /dev/null +++ b/stdlib/source/documentation/lux/meta/type/quotient.lux @@ -0,0 +1,45 @@ +(.require + [library + [lux (.except) + ["$" documentation] + [data + ["[0]" text (.only \n) + ["%" \\format (.only format)]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.class) + ($.default /.value) + ($.default /.label) + ($.default /.equivalence) + + ($.documentation (/.Class value label) + "The class knows how to classify/label values that are meant to be equivalent to one another.") + + ($.documentation (/.Quotient value label) + (format "A quotient value has been labeled with a class." + \n "All equivalent values will belong to the same class." + \n "This means all equivalent values possess the same label.")) + + ($.documentation /.quotient + "" + [(quotient class value)]) + + ($.documentation /.type + "The Quotient type associated with a Class type." + [(def even + (class even?)) + + (def Even + Type + (type even)) + + (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 new file mode 100644 index 000000000..304b4b266 --- /dev/null +++ b/stdlib/source/documentation/lux/meta/type/refinement.lux @@ -0,0 +1,54 @@ +(.require + [library + [lux (.except) + ["$" documentation] + [data + ["[0]" text (.only \n) + ["%" \\format (.only format)]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.value) + ($.default /.predicate) + + ($.documentation (/.Refined it) + "A refined version of another type, using a predicate to select valid instances.") + + ($.documentation (/.Refiner it) + "A selection mechanism for refined instances of a type.") + + ($.documentation /.refiner + "" + [(refiner predicate)]) + + ($.documentation /.lifted + (format "Yields a function that can work on refined values." + \n "Respects the constraints of the refinement.") + [(lifted transform)]) + + ($.documentation /.only + "" + [(only refiner values)]) + + ($.documentation /.partition + "Separates refined values from the un-refined ones." + [(partition refiner values)]) + + ($.documentation /.type + "The Refined type associated with a Refiner type." + [(def even + (refiner even?)) + + (def Even + Type + (type even)) + + (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 new file mode 100644 index 000000000..b4dcfdd6f --- /dev/null +++ b/stdlib/source/documentation/lux/meta/type/resource.lux @@ -0,0 +1,98 @@ +(.require + [library + [lux (.except and) + ["$" documentation] + [data + ["[0]" text (.only \n) + ["%" \\format (.only format)]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) + +(`` (.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.monad) + ($.default /.index_cannot_be_repeated) + ($.default /.amount_cannot_be_zero) + + ($.documentation (/.Procedure monad input output value) + (format "A computation that takes a sequence of resource access rights as inputs and yields a different sequence as outputs." + \n "A procedure yields a result value." + \n "A procedure can make use of monadic effects.")) + + ($.documentation (/.Linear monad value) + (format "A procedure that is constant with regards to resource access rights." + \n "This means no additional resources will be available after the computation is over." + \n "This also means no previously available resources will have been consumed.")) + + ($.documentation (/.Affine monad permissions value) + "A procedure which expands the number of available resources.") + + ($.documentation (/.Relevant monad permissions value) + "A procedure which reduces the number of available resources.") + + ($.documentation /.run! + "" + [(run! monad procedure)]) + + ($.documentation /.lifted + "" + [(lifted monad procedure)]) + + ($.documentation /.Ordered + "The mode of keys which CANNOT be swapped, and for whom order of release/consumption matters.") + + ($.documentation /.Commutative + "The mode of keys which CAN be swapped, and for whom order of release/consumption DOES NOT matters.") + + ($.documentation (/.Key mode key) + (format "The access right for a resource." + \n "Without the key for a resource existing somewhere among the available ambient rights, one cannot use a resource.")) + + ($.documentation (/.Res key value) + (format "A resource locked by a key." + \n "The 'key' represents the right to access/consume a resource.")) + + (,, (with_template [] + [($.documentation + "Makes a value into a resource and adds the key/access-right to it to the ambient keyring for future use.")] + + [/.ordered] + [/.commutative] + )) + + ($.documentation /.read + "Access the value of a resource, so long as its key is available." + [(read monad resource)]) + + ($.documentation /.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)))]) + + (,, (with_template [] + [($.documentation + "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)))])] + + [/.group] + [/.un_group] + ))] + []))) diff --git a/stdlib/source/documentation/lux/meta/type/unit.lux b/stdlib/source/documentation/lux/meta/type/unit.lux new file mode 100644 index 000000000..1f2f6918e --- /dev/null +++ b/stdlib/source/documentation/lux/meta/type/unit.lux @@ -0,0 +1,89 @@ +(.require + [library + [lux (.except and) + ["$" documentation] + [data + ["[0]" text (.only \n) + ["%" \\format (.only format)]]] + [macro + ["[0]" template]] + [math + [number + ["[0]" ratio]]]]] + [\\library + ["[0]" /]]) + +(`` (.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.Gram) + ($.default /.Meter) + ($.default /.Litre) + ($.default /.Second) + ... ($.default /.pure) + ($.default /.number) + ($.default /.equivalence) + ($.default /.order) + ($.default /.enum) + ... ($.default /.Kilo) + ... ($.default /.Mega) + ... ($.default /.Giga) + ... ($.default /.Milli) + ... ($.default /.Micro) + ... ($.default /.Nano) + ($.default /.+) + ($.default /.-) + ($.default /.*) + ($.default /./) + + ($.documentation (/.Measure unit) + "A quantity with an associated unit of measurement.") + + ($.documentation (/.Unit unit) + "A unit of measurement, to qualify numbers with.") + + ... ($.documentation (/.Scale scale) + ... "A scale of magnitude.") + + ... ($.documentation /.Pure + ... "A pure, unit-less measure.") + + ($.documentation /.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 []))]) + + ... ($.documentation /.scale + ... "Define a scale of magnitude." + ... [(def bajillion (scale [1 1,234,567,890]))]) + + ... ($.documentation /.re_scaled + ... "" + ... [(re_scaled from to measure)]) + + ... (,, (with_template [ ] + ... [(`` ($.documentation + ... (let [numerator (the [/.ratio ratio.#numerator] ) + ... denominator (the [/.ratio ratio.#denominator] )] + ... (format "The '" (,, (template.text [])) "' scale, from " (%.nat numerator) " to " (%.nat denominator) "."))))] + + ... [/.Kilo /.kilo] + ... [/.Mega /.mega] + ... [/.Giga /.giga] + + ... [/.Milli /.milli] + ... [/.Micro /.micro] + ... [/.Nano /.nano] + ... )) + + (,, (with_template [] + [(`` ($.documentation + (format "The '" (,, (template.text [])) "' unit of meaurement.")))] + + [/.gram] + [/.meter] + [/.litre] + [/.second] + ))] + []))) diff --git a/stdlib/source/documentation/lux/meta/type/variance.lux b/stdlib/source/documentation/lux/meta/type/variance.lux new file mode 100644 index 000000000..e3b377fea --- /dev/null +++ b/stdlib/source/documentation/lux/meta/type/variance.lux @@ -0,0 +1,25 @@ +(.require + [library + [lux (.except and) + ["$" documentation] + [data + ["[0]" text (.only \n) + ["%" \\format (.only format)]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.documentation (/.Co it) + "A constraint for covariant types.") + + ($.documentation (/.Contra it) + "A constraint for contravariant types.") + + ($.documentation (/.In it) + "A constraint for invariant types.")] + [])) diff --git a/stdlib/source/documentation/lux/static.lux b/stdlib/source/documentation/lux/static.lux index 08b82e86c..9ae73aae8 100644 --- a/stdlib/source/documentation/lux/static.lux +++ b/stdlib/source/documentation/lux/static.lux @@ -14,7 +14,7 @@ (.List $.Module) ($.module /._ "" - [(~~ (with_template [ ] + [(,, (with_template [ ] [($.documentation (%.code (' ( (is @@ -35,7 +35,7 @@ (is ??? (value generating expression)))]) - (~~ (with_template [ ] + (,, (with_template [ ] [($.documentation (%.code (' (is ()))))] diff --git a/stdlib/source/documentation/lux/time.lux b/stdlib/source/documentation/lux/time.lux index 3041638d5..59f609b05 100644 --- a/stdlib/source/documentation/lux/time.lux +++ b/stdlib/source/documentation/lux/time.lux @@ -31,7 +31,7 @@ ($.default /.enum) ($.default /.parser) - (~~ (with_template [ ] + (,, (with_template [ ] [($.documentation )] diff --git a/stdlib/source/documentation/lux/type.lux b/stdlib/source/documentation/lux/type.lux deleted file mode 100644 index a458db5d3..000000000 --- a/stdlib/source/documentation/lux/type.lux +++ /dev/null @@ -1,167 +0,0 @@ -(.require - [library - [lux (.except function as let) - ["$" documentation] - [data - ["[0]" text (.only \n) - ["%" \\format]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]] - ["[0]" / - ["[1][0]" primitive] - ["[1][0]" check] - ["[1][0]" dynamic] - ["[1][0]" implicit] - ["[1][0]" poly] - ["[1][0]" quotient] - ["[1][0]" refinement] - ["[1][0]" resource] - ["[1][0]" unit] - ["[1][0]" variance]]) - -(`` (.def .public documentation - (.List $.Module) - ($.module /._ - "Basic functionality for working with types." - [($.default /.equivalence) - - (~~ (with_template [] - [($.documentation - "The number of parameters, and the body, of a quantified type.")] - - [/.flat_univ_q] - [/.flat_ex_q] - )) - - ($.documentation /.flat_function - "The input, and the output of a function type." - [(flat_function type)]) - - ($.documentation /.flat_application - "The quantified type, and its parameters, for a type-application." - [(flat_application type)]) - - (~~ (with_template [] - [($.documentation - "The members of a composite type.")] - - [/.flat_variant] - [/.flat_tuple] - )) - - ($.documentation /.format - "A (readable) textual representable of a type." - [(format type)]) - - ($.documentation /.applied - "To the extend possible, applies a quantified type to the given parameters." - [(applied params func)]) - - ($.documentation /.code - (%.format "A representation of a type as code." - \n "The code is such that evaluating it would yield the type value.") - [(code type)]) - - ($.documentation /.de_aliased - "A (potentially named) type that does not have its name shadowed by other names." - [(de_aliased type)]) - - ($.documentation /.anonymous - "A type without any names covering it." - [(anonymous type)]) - - (~~ (with_template [] - [($.documentation - "A composite type, constituted by the given member types.")] - - [/.variant] - [/.tuple] - )) - - ($.documentation /.function - "A function type, with the given inputs and output." - [(function inputs output)]) - - ($.documentation /.application - "An un-evaluated type application, with the given quantified type, and parameters." - [(application params quant)]) - - (~~ (with_template [] - [($.documentation - "A quantified type, with the given number of parameters, and body.")] - - [/.univ_q] - [/.ex_q] - )) - - ($.documentation /.quantified? - "Only yields #1 for universally or existentially quantified types." - [(quantified? type)]) - - ($.documentation /.array - "An array type, with the given level of nesting/depth, and the given element type." - [(array depth element_type)]) - - ($.documentation /.flat_array - "The level of nesting/depth and element type for an array type." - [(flat_array type)]) - - ($.documentation /.array? - "Is a type an array type?") - - ($.documentation /.log! - "Logs to the console/terminal the type of an expression." - [(log! (is Foo (foo expression))) - "=>" - "Expression: (foo expression)" - " Type: Foo" - (foo expression)]) - - ($.documentation /.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))))]) - - ($.documentation /.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))))]) - - ($.documentation /.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))]) - - ($.documentation /.let - "Local bindings for types." - [(let [side (Either Int Frac)] - (List [side side]))])] - [/primitive.documentation - /check.documentation - /dynamic.documentation - /implicit.documentation - /poly.documentation - /quotient.documentation - /refinement.documentation - /resource.documentation - /unit.documentation - /variance.documentation]))) diff --git a/stdlib/source/documentation/lux/type/check.lux b/stdlib/source/documentation/lux/type/check.lux deleted file mode 100644 index e5a7130cf..000000000 --- a/stdlib/source/documentation/lux/type/check.lux +++ /dev/null @@ -1,79 +0,0 @@ -(.require - [library - [lux (.except and) - ["$" documentation] - [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "Type-checking functionality." - [($.default /.unknown_type_var) - ($.default /.unbound_type_var) - ($.default /.invalid_type_application) - ($.default /.cannot_rebind_var) - ($.default /.type_check_failed) - ($.default /.functor) - ($.default /.apply) - ($.default /.monad) - ($.default /.bound?) - ($.default /.peek) - ($.default /.read) - - ($.documentation /.Var - "The ID for a type-variable in a type-checking context.") - - ($.documentation (/.Check it) - "A type-checking computation which may fail or yield a value.") - - ($.documentation /.result - "" - [(result context proc)]) - - ($.documentation /.failure - "" - [(failure message)]) - - ($.documentation /.assertion - "" - [(assertion message test)]) - - ($.documentation /.except - "" - [(except exception message)]) - - ($.documentation /.existential - "A brand-new existential type.") - - ($.documentation /.bind - (format "Attemmpts to buy a type-variable." - \n "Fails if the variable has been bound already.") - [(bind type id)]) - - ($.documentation /.var - "A brand-new (unbound) type-variable.") - - ($.documentation /.fresh_context - "An empty/un-used type-checking context.") - - ($.documentation /.check - "Type-check to ensure that the 'expected' type subsumes the 'actual' type." - [(check expected actual)]) - - ($.documentation /.subsumes? - "A simple type-checking function that just returns a yes/no answer." - [(subsumes? expected actual)]) - - ($.documentation /.context - "The current state of the type-checking context.") - - ($.documentation /.clean - "Resolves every bound type-variable to yield a new type that is as resolved as possible." - [(clean inputT)])] - [])) diff --git a/stdlib/source/documentation/lux/type/dynamic.lux b/stdlib/source/documentation/lux/type/dynamic.lux deleted file mode 100644 index 861d7143f..000000000 --- a/stdlib/source/documentation/lux/type/dynamic.lux +++ /dev/null @@ -1,32 +0,0 @@ -(.require - [library - [lux (.except static) - ["$" documentation] - [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.default /.wrong_type) - ($.default /.format) - - ($.documentation /.Dynamic - "A value coupled with its type, so it can be checked later.") - - ($.documentation /.dynamic - "" - [(is Dynamic - (dynamic 123))]) - - ($.documentation /.static - "" - [(is (try.Try Nat) - (static Nat (dynamic 123)))])] - [])) diff --git a/stdlib/source/documentation/lux/type/implicit.lux b/stdlib/source/documentation/lux/type/implicit.lux deleted file mode 100644 index 9490d4aee..000000000 --- a/stdlib/source/documentation/lux/type/implicit.lux +++ /dev/null @@ -1,53 +0,0 @@ -(.require - [library - [lux (.except and) - ["$" documentation] - [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.documentation /.a/an - (format "Automatic implementation selection (for type-class style polymorphism)." - \n "This feature layers type-class style polymorphism on top of Lux's signatures and implementations." - \n "When calling a polymorphic function, or using a polymorphic constant," - \n "this macro will check the types of the arguments, and the expected type for the whole expression" - \n "and it will search in the local scope, the module's scope and the imports' scope" - \n "in order to find suitable implementations to satisfy those requirements." - \n "If a single alternative is found, that one will be used automatically." - \n "If no alternative is found, or if more than one alternative is found (ambiguity)" - \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))]) - - ($.documentation /.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)))]) - - ($.documentation /.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))])] - [])) diff --git a/stdlib/source/documentation/lux/type/poly.lux b/stdlib/source/documentation/lux/type/poly.lux deleted file mode 100644 index 979ae2899..000000000 --- a/stdlib/source/documentation/lux/type/poly.lux +++ /dev/null @@ -1,26 +0,0 @@ -(.require - [library - [lux (.except and) - ["$" documentation] - [abstract - [\\specification - ["$[0]" equivalence] - ["$[0]" codec]]] - [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.default /.polytypic) - - ($.documentation /.code - "" - [(code env type)])] - [])) diff --git a/stdlib/source/documentation/lux/type/primitive.lux b/stdlib/source/documentation/lux/type/primitive.lux deleted file mode 100644 index a015098b7..000000000 --- a/stdlib/source/documentation/lux/type/primitive.lux +++ /dev/null @@ -1,120 +0,0 @@ -(.require - [library - [lux (.except) - ["$" documentation] - [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) - -(`` (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.documentation /.Frame - "Meta-data about an abstract/nominal type in a stack of them.") - - ($.documentation /.current - "The currently-being-defined abstract/nominal type.") - - ($.documentation /.specific - "A specific abstract/nominal type still being defined somewhere in the scope." - [(specific name)]) - - (~~ (with_template [ <$> ] - [($.documentation - "Type-casting macro for abstract/nominal types." - [(|> value - (is ) - <$> - (is ))])] - - [/.abstraction Representation abstraction Abstraction] - [/.representation Abstraction representation Representation] - )) - - ($.documentation /.primitive - (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.") - [(primitive String - Text - - (def (string value) - (-> Text String) - (abstraction value)) - - (def (text value) - (-> String Text) - (representation value)))] - ["Type-parameters are optional." - (primitive (Duplicate a) - [a a] - - (def (duplicate value) - (All (_ a) (-> a (Duplicate a))) - (abstraction [value value])))] - ["Definitions can be nested." - (primitive (Single a) - a - - (def (single value) - (All (_ a) (-> a (Single a))) - (abstraction value)) - - (primitive (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." - (primitive (JavaScript a) - Text - - (primitive Expression Any) - (primitive 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) - "}"))))]) - - ($.documentation /.transmutation - "Transmutes an abstract/nominal type's phantom types." - [(primitive (JavaScript a) - Text - - (primitive Expression Any) - (primitive Statement Any) - - (def (statement expression) - (-> (JavaScript Expression) (JavaScript Statement)) - (transmutation expression)) - - (def (statement' expression) - (-> (JavaScript Expression) (JavaScript Statement)) - (transmutation JavaScript expression)))])] - []))) diff --git a/stdlib/source/documentation/lux/type/quotient.lux b/stdlib/source/documentation/lux/type/quotient.lux deleted file mode 100644 index 1451674e6..000000000 --- a/stdlib/source/documentation/lux/type/quotient.lux +++ /dev/null @@ -1,45 +0,0 @@ -(.require - [library - [lux (.except) - ["$" documentation] - [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.default /.class) - ($.default /.value) - ($.default /.label) - ($.default /.equivalence) - - ($.documentation (/.Class value label) - "The class knows how to classify/label values that are meant to be equivalent to one another.") - - ($.documentation (/.Quotient value label) - (format "A quotient value has been labeled with a class." - \n "All equivalent values will belong to the same class." - \n "This means all equivalent values possess the same label.")) - - ($.documentation /.quotient - "" - [(quotient class value)]) - - ($.documentation /.type - "The Quotient type associated with a Class type." - [(def even - (class even?)) - - (def Even - Type - (type even)) - - (is Even - (quotient even 123))])] - [])) diff --git a/stdlib/source/documentation/lux/type/refinement.lux b/stdlib/source/documentation/lux/type/refinement.lux deleted file mode 100644 index 304b4b266..000000000 --- a/stdlib/source/documentation/lux/type/refinement.lux +++ /dev/null @@ -1,54 +0,0 @@ -(.require - [library - [lux (.except) - ["$" documentation] - [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.default /.value) - ($.default /.predicate) - - ($.documentation (/.Refined it) - "A refined version of another type, using a predicate to select valid instances.") - - ($.documentation (/.Refiner it) - "A selection mechanism for refined instances of a type.") - - ($.documentation /.refiner - "" - [(refiner predicate)]) - - ($.documentation /.lifted - (format "Yields a function that can work on refined values." - \n "Respects the constraints of the refinement.") - [(lifted transform)]) - - ($.documentation /.only - "" - [(only refiner values)]) - - ($.documentation /.partition - "Separates refined values from the un-refined ones." - [(partition refiner values)]) - - ($.documentation /.type - "The Refined type associated with a Refiner type." - [(def even - (refiner even?)) - - (def Even - Type - (type even)) - - (is (Maybe Even) - (even 123))])] - [])) diff --git a/stdlib/source/documentation/lux/type/resource.lux b/stdlib/source/documentation/lux/type/resource.lux deleted file mode 100644 index fa673174a..000000000 --- a/stdlib/source/documentation/lux/type/resource.lux +++ /dev/null @@ -1,98 +0,0 @@ -(.require - [library - [lux (.except and) - ["$" documentation] - [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) - -(`` (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.default /.monad) - ($.default /.index_cannot_be_repeated) - ($.default /.amount_cannot_be_zero) - - ($.documentation (/.Procedure monad input output value) - (format "A computation that takes a sequence of resource access rights as inputs and yields a different sequence as outputs." - \n "A procedure yields a result value." - \n "A procedure can make use of monadic effects.")) - - ($.documentation (/.Linear monad value) - (format "A procedure that is constant with regards to resource access rights." - \n "This means no additional resources will be available after the computation is over." - \n "This also means no previously available resources will have been consumed.")) - - ($.documentation (/.Affine monad permissions value) - "A procedure which expands the number of available resources.") - - ($.documentation (/.Relevant monad permissions value) - "A procedure which reduces the number of available resources.") - - ($.documentation /.run! - "" - [(run! monad procedure)]) - - ($.documentation /.lifted - "" - [(lifted monad procedure)]) - - ($.documentation /.Ordered - "The mode of keys which CANNOT be swapped, and for whom order of release/consumption matters.") - - ($.documentation /.Commutative - "The mode of keys which CAN be swapped, and for whom order of release/consumption DOES NOT matters.") - - ($.documentation (/.Key mode key) - (format "The access right for a resource." - \n "Without the key for a resource existing somewhere among the available ambient rights, one cannot use a resource.")) - - ($.documentation (/.Res key value) - (format "A resource locked by a key." - \n "The 'key' represents the right to access/consume a resource.")) - - (~~ (with_template [] - [($.documentation - "Makes a value into a resource and adds the key/access-right to it to the ambient keyring for future use.")] - - [/.ordered] - [/.commutative] - )) - - ($.documentation /.read - "Access the value of a resource, so long as its key is available." - [(read monad resource)]) - - ($.documentation /.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)))]) - - (~~ (with_template [] - [($.documentation - "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)))])] - - [/.group] - [/.un_group] - ))] - []))) diff --git a/stdlib/source/documentation/lux/type/unit.lux b/stdlib/source/documentation/lux/type/unit.lux deleted file mode 100644 index c7f4948ab..000000000 --- a/stdlib/source/documentation/lux/type/unit.lux +++ /dev/null @@ -1,89 +0,0 @@ -(.require - [library - [lux (.except and) - ["$" documentation] - [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" template]] - [math - [number - ["[0]" ratio]]]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.default /.Gram) - ($.default /.Meter) - ($.default /.Litre) - ($.default /.Second) - ($.default /.pure) - ($.default /.number) - ($.default /.equivalence) - ($.default /.order) - ($.default /.enum) - ($.default /.Kilo) - ($.default /.Mega) - ($.default /.Giga) - ($.default /.Milli) - ($.default /.Micro) - ($.default /.Nano) - ($.default /.+) - ($.default /.-) - ($.default /.*) - ($.default /./) - - ($.documentation (/.Measure unit) - "A quantity with an associated unit of measurement.") - - ($.documentation (/.Unit unit) - "A unit of measurement, to qualify numbers with.") - - ($.documentation (/.Scale scale) - "A scale of magnitude.") - - ($.documentation /.Pure - "A pure, unit-less measure.") - - ($.documentation /.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 []))]) - - ($.documentation /.scale - "Define a scale of magnitude." - [(def bajillion (scale [1 1,234,567,890]))]) - - ($.documentation /.re_scaled - "" - [(re_scaled from to measure)]) - - (~~ (with_template [ ] - [(`` ($.documentation - (let [numerator (the [/.ratio ratio.#numerator] ) - denominator (the [/.ratio ratio.#denominator] )] - (format "The '" (~~ (template.text [])) "' scale, from " (%.nat numerator) " to " (%.nat denominator) "."))))] - - [/.Kilo /.kilo] - [/.Mega /.mega] - [/.Giga /.giga] - - [/.Milli /.milli] - [/.Micro /.micro] - [/.Nano /.nano] - )) - - (~~ (with_template [] - [(`` ($.documentation - (format "The '" (~~ (template.text [])) "' unit of meaurement.")))] - - [/.gram] - [/.meter] - [/.litre] - [/.second] - ))] - [])) diff --git a/stdlib/source/documentation/lux/type/variance.lux b/stdlib/source/documentation/lux/type/variance.lux deleted file mode 100644 index e3b377fea..000000000 --- a/stdlib/source/documentation/lux/type/variance.lux +++ /dev/null @@ -1,25 +0,0 @@ -(.require - [library - [lux (.except and) - ["$" documentation] - [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.documentation (/.Co it) - "A constraint for covariant types.") - - ($.documentation (/.Contra it) - "A constraint for contravariant types.") - - ($.documentation (/.In it) - "A constraint for invariant types.")] - [])) diff --git a/stdlib/source/documentation/lux/world/console.lux b/stdlib/source/documentation/lux/world/console.lux index 44376fa63..f20cac8ef 100644 --- a/stdlib/source/documentation/lux/world/console.lux +++ b/stdlib/source/documentation/lux/world/console.lux @@ -16,10 +16,10 @@ (`` (`` ($.module /._ "" [($.default /.async) - (~~ (for @.jvm (~~ (these ($.default /.cannot_open) + (,, (for @.jvm (,, (these ($.default /.cannot_open) ($.default /.cannot_close) ($.default /.default))) - (~~ (these)))) + (,, (these)))) ($.documentation (/.Console !) "An interface to console/terminal I/O.") diff --git a/stdlib/source/documentation/lux/world/file.lux b/stdlib/source/documentation/lux/world/file.lux index 3ae7449e6..1e99499e9 100644 --- a/stdlib/source/documentation/lux/world/file.lux +++ b/stdlib/source/documentation/lux/world/file.lux @@ -23,8 +23,8 @@ ($.default /.cannot_delete) ($.default /.cannot_make_directory) ($.default /.cannot_find_directory) - (~~ (for @.lua (~~ (these)) - (~~ (these ($.default /.default))))) + (,, (for @.lua (,, (these)) + (,, (these ($.default /.default))))) ($.documentation /.Path "A path to a file or a directory in a file-system.") diff --git a/stdlib/source/documentation/lux/world/file/watch.lux b/stdlib/source/documentation/lux/world/file/watch.lux index c4c3f371c..cc7dbdea9 100644 --- a/stdlib/source/documentation/lux/world/file/watch.lux +++ b/stdlib/source/documentation/lux/world/file/watch.lux @@ -28,9 +28,9 @@ ($.documentation /.Concern "A particular concern to watch-out for.") - ($.documentation /.also + ($.documentation /.and "" - [(also left right)]) + [(and left right)]) ($.documentation (/.Watcher !) "Machinery for watching a file-system for changes to files and directories.") @@ -45,7 +45,7 @@ \n "Must be given a path separator for the file-system.") [(mock separator)]) - (~~ (for @.jvm (~~ (these ($.documentation /.default + (,, (for @.jvm (,, (these ($.documentation /.default "The default watcher for the default file-system."))) - (~~ (these))))] + (,, (these))))] [])))) diff --git a/stdlib/source/documentation/lux/world/net/http/client.lux b/stdlib/source/documentation/lux/world/net/http/client.lux index c0a113a36..fb6e83727 100644 --- a/stdlib/source/documentation/lux/world/net/http/client.lux +++ b/stdlib/source/documentation/lux/world/net/http/client.lux @@ -17,13 +17,13 @@ "" [($.default /.async) ($.default /.headers) - (~~ (for @.jvm (~~ (these ($.default /.default))) - (~~ (these)))) + (,, (for @.jvm (,, (these ($.default /.default))) + (,, (these)))) ($.documentation (/.Client !) "A HTTP client capable of issuing requests to a HTTP server.") - (~~ (with_template [] + (,, (with_template [] [($.documentation (format "A " (text.upper_cased (template.text [])) " request."))] diff --git a/stdlib/source/documentation/lux/world/net/http/status.lux b/stdlib/source/documentation/lux/world/net/http/status.lux index 3d34f709a..81003a4b0 100644 --- a/stdlib/source/documentation/lux/world/net/http/status.lux +++ b/stdlib/source/documentation/lux/world/net/http/status.lux @@ -14,7 +14,7 @@ (.List $.Module) ($.module /._ "" - [(~~ (with_template [] + [(,, (with_template [] [($.documentation (|> (template.text []) (text.replaced "_" " ") diff --git a/stdlib/source/documentation/lux/world/output/video/resolution.lux b/stdlib/source/documentation/lux/world/output/video/resolution.lux index 6efada0de..a0b2e9aaa 100644 --- a/stdlib/source/documentation/lux/world/output/video/resolution.lux +++ b/stdlib/source/documentation/lux/world/output/video/resolution.lux @@ -20,7 +20,7 @@ ($.documentation /.Resolution "A screen resolution.") - (~~ (with_template [] + (,, (with_template [] [($.documentation (let [name (|> (template.text []) (text.replaced "_" " ") diff --git a/stdlib/source/documentation/lux/world/shell.lux b/stdlib/source/documentation/lux/world/shell.lux index d6ae9df5f..4ff4e37c0 100644 --- a/stdlib/source/documentation/lux/world/shell.lux +++ b/stdlib/source/documentation/lux/world/shell.lux @@ -18,9 +18,9 @@ [($.default /.normal) ($.default /.error) ($.default /.async) - (~~ (for @.jvm (~~ (these ($.default /.no_more_output) + (,, (for @.jvm (,, (these ($.default /.no_more_output) ($.default /.default))) - (~~ (these)))) + (,, (these)))) ($.documentation /.Exit "A program exit code.") -- cgit v1.2.3