From 565fe5a2e60ff3c6b612031d1c3bb89f330751da Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 30 Jun 2022 18:15:20 -0400 Subject: Moved ".../dictionary/plist" to ".../list/property". --- stdlib/source/documentation/lux/data.lux | 4 +- stdlib/source/documentation/lux/data/binary.lux | 75 ++++++- .../lux/data/collection/dictionary.lux | 6 +- .../lux/data/collection/dictionary/plist.lux | 48 ----- .../documentation/lux/data/collection/list.lux | 6 +- .../lux/data/collection/list/property.lux | 48 +++++ stdlib/source/documentation/lux/data/format.lux | 4 +- .../documentation/lux/data/format/binary.lux | 93 --------- .../source/documentation/lux/data/format/json.lux | 115 +++++------ .../source/documentation/lux/data/format/tar.lux | 2 +- .../source/documentation/lux/data/format/xml.lux | 31 ++- stdlib/source/documentation/lux/data/text.lux | 74 ++++++- .../documentation/lux/data/text/encoding.lux | 4 +- .../source/documentation/lux/data/text/format.lux | 68 ------- .../documentation/lux/data/text/unicode/block.lux | 4 +- stdlib/source/documentation/lux/target.lux | 4 +- stdlib/source/documentation/lux/target/jvm.lux | 49 ----- stdlib/source/documentation/lux/type/primitive.lux | 218 ++++++++++----------- stdlib/source/documentation/lux/type/resource.lux | 172 ++++++++-------- 19 files changed, 461 insertions(+), 564 deletions(-) delete mode 100644 stdlib/source/documentation/lux/data/collection/dictionary/plist.lux create mode 100644 stdlib/source/documentation/lux/data/collection/list/property.lux delete mode 100644 stdlib/source/documentation/lux/data/format/binary.lux delete mode 100644 stdlib/source/documentation/lux/data/text/format.lux delete mode 100644 stdlib/source/documentation/lux/target/jvm.lux (limited to 'stdlib/source/documentation') diff --git a/stdlib/source/documentation/lux/data.lux b/stdlib/source/documentation/lux/data.lux index 025efb839..088366a27 100644 --- a/stdlib/source/documentation/lux/data.lux +++ b/stdlib/source/documentation/lux/data.lux @@ -1,10 +1,8 @@ (.require [library [lux (.except) - ["$" documentation (.only documentation:)] + ["$" documentation] [data - [text (.only \n) - ["%" \\format (.only format)]] [collection ["[0]" list]]]]] ["[0]" / diff --git a/stdlib/source/documentation/lux/data/binary.lux b/stdlib/source/documentation/lux/data/binary.lux index 80e05d511..61395234c 100644 --- a/stdlib/source/documentation/lux/data/binary.lux +++ b/stdlib/source/documentation/lux/data/binary.lux @@ -7,9 +7,82 @@ ["%" \\format (.only format)]]] [macro ["[0]" template]]]] + ["[0]" \\format] [\\library ["[0]" /]]) +(.def \\format + (.List $.Module) + ($.module \\format._ + "" + [($.default \\format.monoid) + ($.default \\format.bits_8) + ($.default \\format.bits_16) + ($.default \\format.bits_32) + ($.default \\format.bits_64) + ($.default \\format.any) + ($.default \\format.bit) + ($.default \\format.nat) + ($.default \\format.int) + ($.default \\format.rev) + ($.default \\format.frac) + ($.default \\format.binary_8) + ($.default \\format.binary_16) + ($.default \\format.binary_32) + ($.default \\format.binary_64) + ($.default \\format.utf8_8) + ($.default \\format.utf8_16) + ($.default \\format.utf8_32) + ($.default \\format.utf8_64) + ($.default \\format.text) + ($.default \\format.sequence_8) + ($.default \\format.sequence_16) + ($.default \\format.sequence_32) + ($.default \\format.sequence_64) + ($.default \\format.maybe) + ($.default \\format.list) + ($.default \\format.set) + ($.default \\format.symbol) + ($.default \\format.type) + ($.default \\format.location) + ($.default \\format.code) + + ($.documentation \\format.Mutation + "A mutation of binary data, tracking where in the data to transform.") + + ($.documentation \\format.Specification + "A description of how to transform binary data.") + + ($.documentation \\format.no_op + "A specification for empty binary data.") + + ($.documentation \\format.instance + "Given a specification of how to construct binary data, yields a binary blob that matches it.") + + ($.documentation (\\format.Format it) + "An operation that knows how to write information into a binary blob.") + + ($.documentation \\format.result + "Yields a binary blob with all the information written to it." + [(result format value)]) + + ($.documentation \\format.or + "" + [(or left right)]) + + ($.documentation \\format.and + "" + [(and pre post)]) + + ($.documentation \\format.rec + "A combinator for recursive formats." + [(rec body)]) + + ($.documentation \\format.segment + "Writes at most 'size' bytes of an input binary blob." + [(segment size)])] + [])) + (.def .public documentation (.List $.Module) ($.module /._ @@ -74,4 +147,4 @@ ($.documentation /.after "Yields a binary BLOB with at most the specified number of bytes removed." [(after bytes binary)])] - [])) + [..\\format])) diff --git a/stdlib/source/documentation/lux/data/collection/dictionary.lux b/stdlib/source/documentation/lux/data/collection/dictionary.lux index 114050284..342d79f15 100644 --- a/stdlib/source/documentation/lux/data/collection/dictionary.lux +++ b/stdlib/source/documentation/lux/data/collection/dictionary.lux @@ -11,8 +11,7 @@ [\\library ["[0]" /]] ["[0]" / - ["[1][0]" ordered] - ["[1][0]" plist]]) + ["[1][0]" ordered]]) (.def .public documentation (.List $.Module) @@ -85,5 +84,4 @@ ($.documentation /.sub "A sub-dictionary, with only the specified keys." [(sub keys dict)])] - [/ordered.documentation - /plist.documentation])) + [/ordered.documentation])) diff --git a/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux b/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux deleted file mode 100644 index 2e478812e..000000000 --- a/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux +++ /dev/null @@ -1,48 +0,0 @@ -(.require - [library - [lux (.except has revised) - ["$" documentation] - [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" code] - ["[0]" template]]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.default /.empty) - ($.default /.size) - ($.default /.empty?) - ($.default /.keys) - ($.default /.values) - ($.default /.equivalence) - - ($.documentation (/.PList it) - (format "A property list." - \n "It's a simple dictionary-like structure with Text keys.")) - - ($.documentation /.value - "" - [(value key properties)]) - - ($.documentation /.contains? - "" - [(contains? key properties)]) - - ($.documentation /.has - "" - [(has key val properties)]) - - ($.documentation /.revised - "" - [(revised key f properties)]) - - ($.documentation /.lacks - "" - [(lacks key properties)])] - [])) diff --git a/stdlib/source/documentation/lux/data/collection/list.lux b/stdlib/source/documentation/lux/data/collection/list.lux index e0699154e..d3fb2c080 100644 --- a/stdlib/source/documentation/lux/data/collection/list.lux +++ b/stdlib/source/documentation/lux/data/collection/list.lux @@ -9,7 +9,9 @@ ["[0]" code] ["[0]" template]]]] [\\library - ["[0]" /]]) + ["[0]" /]] + ["[0]" / + ["[1][0]" property]]) (`` (.def .public documentation (.List $.Module) @@ -165,4 +167,4 @@ [value (do_something 1 2 3) .when (passes_test? value)] (do_something_else 4 5 6))])] - []))) + [/property.documentation]))) diff --git a/stdlib/source/documentation/lux/data/collection/list/property.lux b/stdlib/source/documentation/lux/data/collection/list/property.lux new file mode 100644 index 000000000..99e2faf06 --- /dev/null +++ b/stdlib/source/documentation/lux/data/collection/list/property.lux @@ -0,0 +1,48 @@ +(.require + [library + [lux (.except has revised) + ["$" documentation] + [data + ["[0]" text (.only \n) + ["%" \\format (.only format)]]] + [macro + ["[0]" code] + ["[0]" template]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.empty) + ($.default /.size) + ($.default /.empty?) + ($.default /.keys) + ($.default /.values) + ($.default /.equivalence) + + ($.documentation (/.List it) + (format "A property list." + \n "It's a simple dictionary-like structure with Text keys.")) + + ($.documentation /.value + "" + [(value key properties)]) + + ($.documentation /.contains? + "" + [(contains? key properties)]) + + ($.documentation /.has + "" + [(has key val properties)]) + + ($.documentation /.revised + "" + [(revised key f properties)]) + + ($.documentation /.lacks + "" + [(lacks key properties)])] + [])) diff --git a/stdlib/source/documentation/lux/data/format.lux b/stdlib/source/documentation/lux/data/format.lux index 794ebe065..7dbf22055 100644 --- a/stdlib/source/documentation/lux/data/format.lux +++ b/stdlib/source/documentation/lux/data/format.lux @@ -8,7 +8,6 @@ [collection ["[0]" list]]]]] ["[0]" / - ["[1][0]" binary] ["[1][0]" json] ["[1][0]" tar] ["[1][0]" xml]]) @@ -16,8 +15,7 @@ (.def .public documentation (.List $.Module) (list.together - (list /binary.documentation - /json.documentation + (list /json.documentation /tar.documentation /xml.documentation ))) diff --git a/stdlib/source/documentation/lux/data/format/binary.lux b/stdlib/source/documentation/lux/data/format/binary.lux deleted file mode 100644 index b2ea53f63..000000000 --- a/stdlib/source/documentation/lux/data/format/binary.lux +++ /dev/null @@ -1,93 +0,0 @@ -(.require - [library - [lux (.except nat int rev list or and symbol) - ["$" documentation (.only documentation:)] - [data - [text (.only \n) - ["%" \\format (.only format)]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) - -(documentation: /.Mutation - "A mutation of binary data, tracking where in the data to transform.") - -(documentation: /.Specification - "A description of how to transform binary data.") - -(documentation: /.no_op - "A specification for empty binary data.") - -(documentation: /.instance - "Given a specification of how to construct binary data, yields a binary blob that matches it.") - -(documentation: (/.Format it) - "An operation that knows how to write information into a binary blob.") - -(documentation: /.result - "Yields a binary blob with all the information written to it." - [(result format value)]) - -(documentation: /.or - "" - [(or left right)]) - -(documentation: /.and - "" - [(and pre post)]) - -(documentation: /.rec - "A combinator for recursive formats." - [(rec body)]) - -(documentation: /.segment - "Writes at most 'size' bytes of an input binary blob." - [(segment size)]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [..Mutation - ..Specification - ..no_op - ..instance - ..Format - ..result - ..or - ..and - ..rec - ..segment - ($.default /.monoid) - ($.default /.bits_8) - ($.default /.bits_16) - ($.default /.bits_32) - ($.default /.bits_64) - ($.default /.any) - ($.default /.bit) - ($.default /.nat) - ($.default /.int) - ($.default /.rev) - ($.default /.frac) - ($.default /.binary_8) - ($.default /.binary_16) - ($.default /.binary_32) - ($.default /.binary_64) - ($.default /.utf8_8) - ($.default /.utf8_16) - ($.default /.utf8_32) - ($.default /.utf8_64) - ($.default /.text) - ($.default /.sequence_8) - ($.default /.sequence_16) - ($.default /.sequence_32) - ($.default /.sequence_64) - ($.default /.maybe) - ($.default /.list) - ($.default /.set) - ($.default /.symbol) - ($.default /.type) - ($.default /.location) - ($.default /.code)] - [])) diff --git a/stdlib/source/documentation/lux/data/format/json.lux b/stdlib/source/documentation/lux/data/format/json.lux index bda2246e2..2051ee55c 100644 --- a/stdlib/source/documentation/lux/data/format/json.lux +++ b/stdlib/source/documentation/lux/data/format/json.lux @@ -1,7 +1,7 @@ (.require [library - [lux (.except nat int rev list or and has) - ["$" documentation (.only documentation:)] + [lux (.except) + ["$" documentation] [data [text (.only \n) ["%" \\format (.only format)]]] @@ -10,70 +10,59 @@ [\\library ["[0]" /]]) -(documentation: /.json - "A simple way to produce JSON literals." - ["null" - (json #null)] - ["true" - (json #1)] - ["123.456" - (json +123.456)] - ["'this is a string'" - (json "this is a string")] - ["['this' 'is' 'an' 'array']" - (json ["this" "is" "an" "array"])] - ["{'this' 'is', 'an' 'object'}" - (json {"this" "is" "an" "object"})]) +(`` (.def .public documentation + (.List $.Module) + ($.module /._ + (format "Functionality for reading and writing values in the JSON format." + \n "For more information, please see: http://www.json.org/") + [($.default /.Null) + ($.default /.Boolean) + ($.default /.Number) + ($.default /.String) + ($.default /.JSON) + ($.default /.Array) + ($.default /.Object) + ($.default /.null?) + ($.default /.object) + ($.default /.equivalence) + ($.default /.format) + ($.default /.codec) -(documentation: /.fields - "Get all the fields in a JSON object." - [(fields json)]) + ($.documentation /.json + "A simple way to produce JSON literals." + ["null" + (json #null)] + ["true" + (json #1)] + ["123.456" + (json +123.456)] + ["'this is a string'" + (json "this is a string")] + ["['this' 'is' 'an' 'array']" + (json ["this" "is" "an" "array"])] + ["{'this' 'is', 'an' 'object'}" + (json {"this" "is" "an" "object"})]) -(documentation: /.field - "A JSON object field getter." - [(field key json)]) + ($.documentation /.fields + "Get all the fields in a JSON object." + [(fields json)]) -(documentation: /.has - "A JSON object field setter." - [(has key value json)]) + ($.documentation /.field + "A JSON object field getter." + [(field key json)]) -(with_template [ ] - [(documentation: - (format "A JSON object field getter for " "."))] + ($.documentation /.has + "A JSON object field setter." + [(has key value json)]) - [/.boolean_field "booleans"] - [/.number_field "numbers"] - [/.string_field "strings"] - [/.array_field "arrays"] - [/.object_field "objects"] - ) + (~~ (with_template [ ] + [($.documentation + (format "A JSON object field getter for " "."))] -(.def .public documentation - (.List $.Module) - ($.module /._ - (format "Functionality for reading and writing values in the JSON format." - \n "For more information, please see: http://www.json.org/") - [..json - ..fields - ..field - ..has - - ..boolean_field - ..number_field - ..string_field - ..array_field - ..object_field - - ($.default /.Null) - ($.default /.Boolean) - ($.default /.Number) - ($.default /.String) - ($.default /.JSON) - ($.default /.Array) - ($.default /.Object) - ($.default /.null?) - ($.default /.object) - ($.default /.equivalence) - ($.default /.format) - ($.default /.codec)] - [])) + [/.boolean_field "booleans"] + [/.number_field "numbers"] + [/.string_field "strings"] + [/.array_field "arrays"] + [/.object_field "objects"] + ))] + []))) diff --git a/stdlib/source/documentation/lux/data/format/tar.lux b/stdlib/source/documentation/lux/data/format/tar.lux index 8da6c890f..353d83876 100644 --- a/stdlib/source/documentation/lux/data/format/tar.lux +++ b/stdlib/source/documentation/lux/data/format/tar.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/data/format/xml.lux b/stdlib/source/documentation/lux/data/format/xml.lux index afb0bc9ee..002f24eff 100644 --- a/stdlib/source/documentation/lux/data/format/xml.lux +++ b/stdlib/source/documentation/lux/data/format/xml.lux @@ -1,7 +1,7 @@ (.require [library - [lux (.except nat int rev list or and) - ["$" documentation (.only documentation:)] + [lux (.except) + ["$" documentation] [data [text (.only \n) ["%" \\format (.only format)]]] @@ -10,27 +10,24 @@ [\\library ["[0]" /]]) -(documentation: /.attributes - "An empty set of XML attributes.") - -(documentation: /.tag - "The text format of a XML tag." - [(tag name)]) - -(documentation: /.attribute - "The text format of a XML attribute.") - (.def .public documentation (.List $.Module) ($.module /._ "" - [..attributes - ..tag - ..attribute - ($.default /.Tag) + [($.default /.Tag) ($.default /.Attribute) ($.default /.Attrs) ($.default /.XML) ($.default /.codec) - ($.default /.equivalence)] + ($.default /.equivalence) + + ($.documentation /.attributes + "An empty set of XML attributes.") + + ($.documentation /.tag + "The text format of a XML tag." + [(tag name)]) + + ($.documentation /.attribute + "The text format of a XML attribute.")] [])) diff --git a/stdlib/source/documentation/lux/data/text.lux b/stdlib/source/documentation/lux/data/text.lux index d0ca26967..3be4f68f6 100644 --- a/stdlib/source/documentation/lux/data/text.lux +++ b/stdlib/source/documentation/lux/data/text.lux @@ -1,22 +1,75 @@ (.require [library - [lux (.except char) - ["$" documentation] - [data - [text - ["%" \\format (.only format)]] - [collection - ["[0]" list]]]]] + [lux (.except) + ["$" documentation]]] ["[0]" / ["[1][0]" buffer] ["[1][0]" encoding] ["[1][0]" escape] - ["[1][0]" format] ["[1][0]" regex] ["[1][0]" unicode]] + ["[0]" \\format] [\\library ["[0]" /]]) +(.def \\format + (.List $.Module) + ($.module \\format._ + "" + [($.default \\format.functor) + + ($.default \\format.bit) + ($.default \\format.nat) + ($.default \\format.int) + ($.default \\format.rev) + ($.default \\format.frac) + ($.default \\format.text) + + ($.default \\format.ratio) + ($.default \\format.symbol) + ($.default \\format.location) + ($.default \\format.code) + ($.default \\format.type) + + ($.default \\format.instant) + ($.default \\format.duration) + ($.default \\format.date) + ($.default \\format.time) + ($.default \\format.day) + ($.default \\format.month) + + ($.default \\format.xml) + ($.default \\format.json) + + ($.default \\format.nat_2) + ($.default \\format.nat_8) + ($.default \\format.nat_10) + ($.default \\format.nat_16) + ($.default \\format.int_2) + ($.default \\format.int_8) + ($.default \\format.int_10) + ($.default \\format.int_16) + ($.default \\format.rev_2) + ($.default \\format.rev_8) + ($.default \\format.rev_10) + ($.default \\format.rev_16) + ($.default \\format.frac_2) + ($.default \\format.frac_8) + ($.default \\format.frac_10) + ($.default \\format.frac_16) + + ($.default \\format.mod) + ($.default \\format.list) + ($.default \\format.maybe) + + ($.documentation (\\format.Format it) + "A way to produce readable text from values.") + + ($.documentation \\format.format + "Text interpolation." + [(format "Static part " (text static) " does not match URI: " uri)])] + [])) + (.def .public documentation (.List $.Module) ($.module /._ @@ -143,9 +196,10 @@ ($.documentation /.space? "Checks whether the character is white-space." [(space? char)])] - [/buffer.documentation + [..\\format + + /buffer.documentation /encoding.documentation /escape.documentation - /format.documentation /regex.documentation /unicode.documentation])) diff --git a/stdlib/source/documentation/lux/data/text/encoding.lux b/stdlib/source/documentation/lux/data/text/encoding.lux index fbc82281a..6a8652b67 100644 --- a/stdlib/source/documentation/lux/data/text/encoding.lux +++ b/stdlib/source/documentation/lux/data/text/encoding.lux @@ -18,11 +18,11 @@ "" [($.default /.name) - (documentation: /.Encoding + ($.documentation /.Encoding "Encoding formats for text.") (~~ (with_template [] - [(documentation: + [($.documentation (format "'" (/.name ) "' text encoding. "))] [/.ascii] diff --git a/stdlib/source/documentation/lux/data/text/format.lux b/stdlib/source/documentation/lux/data/text/format.lux deleted file mode 100644 index c7dbb68b5..000000000 --- a/stdlib/source/documentation/lux/data/text/format.lux +++ /dev/null @@ -1,68 +0,0 @@ -(.require - [library - [lux (.except nat int rev list symbol) - ["$" documentation (.only documentation:)] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) - -(documentation: (/.Format it) - "A way to produce readable text from values.") - -(documentation: /.format - "Text interpolation." - [(format "Static part " (text static) " does not match URI: " uri)]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [..Format - ..format - ($.default /.functor) - - ($.default /.bit) - ($.default /.nat) - ($.default /.int) - ($.default /.rev) - ($.default /.frac) - ($.default /.text) - - ($.default /.ratio) - ($.default /.symbol) - ($.default /.location) - ($.default /.code) - ($.default /.type) - - ($.default /.instant) - ($.default /.duration) - ($.default /.date) - ($.default /.time) - ($.default /.day) - ($.default /.month) - - ($.default /.xml) - ($.default /.json) - - ($.default /.nat_2) - ($.default /.nat_8) - ($.default /.nat_10) - ($.default /.nat_16) - ($.default /.int_2) - ($.default /.int_8) - ($.default /.int_10) - ($.default /.int_16) - ($.default /.rev_2) - ($.default /.rev_8) - ($.default /.rev_10) - ($.default /.rev_16) - ($.default /.frac_2) - ($.default /.frac_8) - ($.default /.frac_10) - ($.default /.frac_16) - - ($.default /.mod) - ($.default /.list) - ($.default /.maybe)] - [])) diff --git a/stdlib/source/documentation/lux/data/text/unicode/block.lux b/stdlib/source/documentation/lux/data/text/unicode/block.lux index 95868365e..0ee609dd9 100644 --- a/stdlib/source/documentation/lux/data/text/unicode/block.lux +++ b/stdlib/source/documentation/lux/data/text/unicode/block.lux @@ -3,13 +3,13 @@ [lux (.except) ["$" documentation] [data - ["[0]" text + ["[0]" text (.only) ["%" \\format (.only format)]]] [macro ["[0]" template]] [math [number - ["[0]" nat ("hex#[0]" hex)]]]]] + ["[0]" nat (.use "hex#[0]" hex)]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/documentation/lux/target.lux b/stdlib/source/documentation/lux/target.lux index 70ba24c62..a10a6e3f5 100644 --- a/stdlib/source/documentation/lux/target.lux +++ b/stdlib/source/documentation/lux/target.lux @@ -11,7 +11,7 @@ ["[0]" /]] ["[0]" / ["[1][0]" js] - ["[1][0]" jvm] + ["[1][0]" jvm/type] ["[1][0]" lua] ["[1][0]" python] ["[1][0]" ruby]]) @@ -35,7 +35,7 @@ (format "The name/ID of a platform targetted by a Lux compiler." \n "This information can be used to generate code targetting specific platforms, and to make programs cross-platform."))] [/js.documentation - /jvm.documentation + /jvm/type.documentation /lua.documentation /python.documentation /ruby.documentation])) diff --git a/stdlib/source/documentation/lux/target/jvm.lux b/stdlib/source/documentation/lux/target/jvm.lux deleted file mode 100644 index 440ef5775..000000000 --- a/stdlib/source/documentation/lux/target/jvm.lux +++ /dev/null @@ -1,49 +0,0 @@ -(.require - [library - [lux (.except char) - ["$" documentation] - [data - [text (.only \n) - ["%" \\format (.only format)]] - [collection - ["[0]" list]]]]] - [\\library - ["[0]" /]] - ["[0]" / - ["[1][0]" type]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.default /.Literal) - ($.default /.Constant) - ($.default /.Int_Arithmetic) - ($.default /.Long_Arithmetic) - ($.default /.Float_Arithmetic) - ($.default /.Double_Arithmetic) - ($.default /.Arithmetic) - ($.default /.Int_Bitwise) - ($.default /.Long_Bitwise) - ($.default /.Bitwise) - ($.default /.Conversion) - ($.default /.Array) - ($.default /.Object) - ($.default /.Register) - ($.default /.Local_Int) - ($.default /.Local_Long) - ($.default /.Local_Float) - ($.default /.Local_Double) - ($.default /.Local_Object) - ($.default /.Local) - ($.default /.Stack) - ($.default /.Comparison) - ($.default /.Label) - ($.default /.Branching) - ($.default /.Exception) - ($.default /.Concurrency) - ($.default /.Return) - ($.default /.Control) - ($.default /.Instruction) - ($.default /.Bytecode)] - [/type.documentation])) diff --git a/stdlib/source/documentation/lux/type/primitive.lux b/stdlib/source/documentation/lux/type/primitive.lux index f91104900..a015098b7 100644 --- a/stdlib/source/documentation/lux/type/primitive.lux +++ b/stdlib/source/documentation/lux/type/primitive.lux @@ -10,113 +10,111 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.default /.no_active_frames) - - ($.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)))])] - [])) +(`` (.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/resource.lux b/stdlib/source/documentation/lux/type/resource.lux index d5615d0dc..fa673174a 100644 --- a/stdlib/source/documentation/lux/type/resource.lux +++ b/stdlib/source/documentation/lux/type/resource.lux @@ -10,89 +10,89 @@ [\\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] - ))] - [])) +(`` (.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] + ))] + []))) -- cgit v1.2.3