diff options
Diffstat (limited to 'stdlib/source')
90 files changed, 1031 insertions, 1135 deletions
diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index 78e0f8fb8..1d675d339 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -2,7 +2,7 @@ [library [lux [program (.only program:)] - ["$" documentation (.only documentation:)] + ["$" documentation (.only documentation)] ["[0]" debug] [control ["[0]" io] @@ -39,958 +39,849 @@ ["[1][0]" type] ["[1][0]" world]]) -(documentation: /.prelude - (format "The name of the prelude module" - \n "Value: " (%.text /.prelude))) - -(documentation: /.Any - (format "The type of things whose type is irrelevant." - \n "It can be used to write functions or data-structures that can take, or return, anything.")) - -(documentation: /.Nothing - (format "The type of things whose type is undefined." - \n "Useful for expressions that cause errors or other 'extraordinary' conditions.")) - -(documentation: (/.List item) - "A potentially empty list of values.") +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [(documentation /.prelude + (format "The name of the prelude module" + \n "Value: " (%.text /.prelude))) -(documentation: /.Bit - "Your standard, run-of-the-mill boolean values (as #0 or #1 bits).") + (documentation /.Any + (format "The type of things whose type is irrelevant." + \n "It can be used to write functions or data-structures that can take, or return, anything.")) -(documentation: (/.I64 kind) - "64-bit integers without any semantics.") + (documentation /.Nothing + (format "The type of things whose type is undefined." + \n "Useful for expressions that cause errors or other 'extraordinary' conditions.")) -(documentation: /.Nat - (format "Natural numbers (unsigned integers)." - \n "They start at zero (0) and extend in the positive direction.")) + (documentation (/.List item) + "A potentially empty list of values.") -(documentation: /.Int - "Your standard, run-of-the-mill integer numbers.") + (documentation /.Bit + "Your standard, run-of-the-mill boolean values (as #0 or #1 bits).") -(documentation: /.Rev - (format "Fractional numbers that live in the interval [0,1)." - \n "Useful for probability, and other domains that work within that interval.")) + (documentation (/.I64 kind) + "64-bit integers without any semantics.") -(documentation: /.Frac - "Your standard, run-of-the-mill floating-point (fractional) numbers.") + (documentation /.Nat + (format "Natural numbers (unsigned integers)." + \n "They start at zero (0) and extend in the positive direction.")) -(documentation: /.Text - "Your standard, run-of-the-mill string values.") + (documentation /.Int + "Your standard, run-of-the-mill integer numbers.") -(documentation: /.Symbol - (format "A name for a Lux definition." - \n "It includes the module of provenance.")) + (documentation /.Rev + (format "Fractional numbers that live in the interval [0,1)." + \n "Useful for probability, and other domains that work within that interval.")) -(documentation: (/.Maybe value) - "A potentially missing value.") + (documentation /.Frac + "Your standard, run-of-the-mill floating-point (fractional) numbers.") -(documentation: /.Type - "This type represents the data-structures that are used to specify types themselves.") + (documentation /.Text + "Your standard, run-of-the-mill string values.") -(documentation: /.Location - "Locations are for specifying the location of Code nodes in Lux files during compilation.") + (documentation /.Symbol + (format "A name for a Lux definition." + \n "It includes the module of provenance.")) -(documentation: (/.Ann meta_data datum) - "The type of things that can be annotated with meta-data of arbitrary types.") + (documentation (/.Maybe value) + "A potentially missing value.") -(documentation: /.Code - "The type of Code nodes for Lux syntax.") + (documentation /.Type + "This type represents the data-structures that are used to specify types themselves.") -(documentation: /.private - "The export policy for private/local definitions.") - -(documentation: /.local - "The export policy for private/local definitions.") - -(documentation: /.public - "The export policy for public/global definitions.") - -(documentation: /.global - "The export policy for public/global definitions.") - -(documentation: /.Definition - "Represents all the data associated with a definition: its type, its annotations, and its value.") - -(documentation: /.Global - "Represents all the data associated with a global constant.") - -(documentation: (/.Either left right) - "A choice between two values of different types.") - -(documentation: /.Module - "All the information contained within a Lux module.") - -(documentation: /.Mode - "A sign that shows the conditions under which the compiler is running.") - -(documentation: /.Info - "Information about the current version and type of compiler that is running.") - -(documentation: /.Lux - (format "Represents the state of the Lux compiler during a run." - \n "It is provided to macros during their invocation, so they can access compiler data." - \n "Caveat emptor: Avoid fiddling with it, unless you know what you're doing.")) - -(documentation: (/.Meta it) - (format "Computations that can have access to the state of the compiler." - \n "These computations may fail, or modify the state of the compiler.")) - -(documentation: /.Macro - "Functions that run at compile-time and allow you to transform and extend the language in powerful ways.") - -(documentation: /.comment - (format "Throws away any code given to it." - \n "Great for commenting-out code, while retaining syntax high-lighting and formatting in your text editor.") - [(comment - (def: (this will not) - (Be Defined) - (because it will be (commented out))))]) - -(documentation: /.All - "Universal quantification." - [(All (_ a) - (-> a a))] - ["A name can be provided, to specify a recursive type." - (All (List a) - (Or Any - [a (List a)]))]) - -(documentation: /.Ex - "Existential quantification." - [(Ex (_ a) - [(Codec Text a) a])] - ["A name can be provided, to specify a recursive type." - (Ex (Self a) - [(Codec Text a) - a - (List (Self a))])]) - -(documentation: /.-> - "Function types." - ["This is the type of a function that takes 2 Ints and returns an Int." - (-> Int Int Int)]) - -(documentation: /.list - "List literals." - [(is (List Nat) - (list 0 1 2 3))]) - -(documentation: /.Union - "Union types." - [(Union Bit Nat Text)] - [(= Nothing - (Union))]) - -(documentation: /.Tuple - "Tuple types." - [(Tuple Bit Nat Text)] - [(= Any - (Tuple))]) - -(documentation: /.Or - "An alias for the Union type constructor." - [(= (Union Bit Nat Text) - (Or Bit Nat Text))] - [(= (Union) - (Or))]) - -(documentation: /.And - "An alias for the Tuple type constructor." - [(= (Tuple Bit Nat Text) - (And Bit Nat Text))] - [(= (Tuple) - (And))]) - -(documentation: /.left - "Left-association for the application of binary functions over variadic arguments." - [(left text#composite "Hello, " name ". How are you?") - "=>" - (text#composite (text#composite "Hello, " name) ". How are you?")]) - -(documentation: /.all - "Right-association for the application of binary functions over variadic arguments." - [(all text#composite "Hello, " name ". How are you?") - "=>" - (text#composite "Hello, " (text#composite name ". How are you?"))]) - -(documentation: /.if - "Picks which expression to evaluate based on a bit test value." - [(if #1 - "Oh, yeah!" - "Aw hell naw!") - "=>" - "Oh, yeah!"] - [(if #0 - "Oh, yeah!" - "Aw hell naw!") - "=>" - "Aw hell naw!"]) - -(documentation: /.Primitive - "Macro to treat define new primitive types." - [(Primitive "java.lang.Object")] - [(Primitive "java.util.List" [(Primitive "java.lang.Long")])]) - -(documentation: /.` - (format "Hygienic quasi-quotation as a macro." - \n "Unquote (~) and unquote-splice (~+) must also be used as forms." - \n "All unprefixed macros will receive their parent module's prefix if imported; otherwise will receive the prefix of the module on which the quasi-quote is being used.") - [(` (def: (~ name) - (function ((~' _) (~+ args)) - (~ body))))]) - -(documentation: /.`' - (format "Unhygienic quasi-quotation as a macro." - \n "Unquote (~) and unquote-splice (~+) must also be used as forms.") - [(`' (def: (~ name) - (function (_ (~+ args)) - (~ body))))]) - -(documentation: /.' - "Quotation as a macro." - [(' YOLO)]) - -(documentation: /.|> - "Piping macro." - [(|> elems - (list#each int#encoded) - (interposed " ") - (mix text#composite "")) - "=>" - (mix text#composite "" - (interposed " " - (list#each int#encoded - elems)))]) - -(documentation: /.<| - "Reverse piping macro." - [(<| (mix text#composite "") - (interposed " ") - (list#each int#encoded) - elems) - "=>" - (mix text#composite "" - (interposed " " - (list#each int#encoded - elems)))]) - -(documentation: /.template - "" - ["By specifying a pattern (with holes), and the input data to fill those holes, repeats the pattern as many times as necessary." - (with_template [<name> <diff>] - [(def: .public <name> - (-> Int Int) - (+ <diff>))] - - [++ +1] - [-- -1] - )]) - -(documentation: /.not - "Bit negation." - [(not #1) - "=>" - #0] - [(not #0) - "=>" - #1]) - -(documentation: /.type - "Takes a type expression and returns its representation as data-structure." - [(type (All (_ a) - (Maybe (List a))))]) - -(documentation: /.is - "The type-annotation macro." - [(is (List Int) - (list +1 +2 +3))]) - -(documentation: /.as - "The type-coercion macro." - [(as Dinosaur - (list +1 +2 +3))]) - -(documentation: /.Rec - "Parameter-less recursive types." - ["A name has to be given to the whole type, to use it within its body." - (Rec Int_List - (Or Any - [Int Int_List]))] - ["Can also be used with type: and labelled-type definitions." - (type: Type - (Rec @ - (Variant - {#Primitive Text (List @)} - {#Sum @ @} - {#Product @ @} - {#Function @ @} - {#Parameter Nat} - {#Var Nat} - {#Ex Nat} - {#UnivQ (List @) @} - {#ExQ (List @) @} - {#Apply @ @} - {#Named Symbol @})))]) - -(documentation: /.exec - "Sequential execution of expressions (great for side-effects)." - [(exec - (log! "#1") - (log! "#2") - (log! "#3") - "YOLO")]) - -(documentation: /.case - (format "The pattern-matching macro." - \n "Allows the usage of macros within the patterns to provide custom syntax.") - [(case (is (List Int) - (list +1 +2 +3)) - {#Item x {#Item y {#Item z {#End}}}} - {#Some (all * x y z)} - - _ - {#None})]) - -(documentation: /.pattern - (format "Macro-expanding patterns." - \n "It's a special macro meant to be used with 'case'.") - [(case (is (List Int) - (list +1 +2 +3)) - (pattern (list x y z)) - {#Some (all * x y z)} - - _ - {#None})]) - -... (documentation: /.^or -... (format "Or-patterns." -... \n "It's a special macro meant to be used with 'case'.") -... [(type: Weekday -... (Variant -... {#Monday} -... {#Tuesday} -... {#Wednesday} -... {#Thursday} -... {#Friday} -... {#Saturday} -... {#Sunday})) - -... (def: (weekend? day) -... (-> Weekday Bit) -... (case day -... (^or {#Saturday} {#Sunday}) -... #1 - -... _ -... #0))]) - -(documentation: /.let - (format "Creates local bindings." - \n "Can (optionally) use pattern-matching macros when binding.") - [(let [x (foo bar) - y (baz quux)] - (op x y))]) - -(documentation: /.function - "Syntax for creating functions." - [(is (All (_ a b) - (-> a b a)) - (function (_ x y) - x))] - ["Allows for giving the function itself a name, for the sake of recursion." - (is (-> Nat Nat) - (function (factorial n) - (case n - 0 1 - _ (* n (factorial (-- n))))))]) - -(documentation: /.def: - "Defines global constants/functions." - [(def: branching_exponent - Int - +5)] - ["The type is optional." - (def: branching_exponent - +5)] - [(def: (pair_list pair) - (-> [Code Code] (List Code)) - (let [[left right] pair] - (list left right)))] - ["Can pattern-match on the inputs to functions." - (def: (pair_list [left right]) - (-> [Code Code] (List Code)) - (list left right))]) - -(documentation: /.macro - "Macro-definition macro." - [(def: .public symbol - (macro (_ tokens) - (case tokens - (^with_template [<tag>] - [(pattern (list [_ {<tag> [module name]}])) - (in (list (` [(~ (text$ module)) (~ (text$ name))])))]) - ([#Symbol]) - - _ - (failure "Wrong syntax for symbol"))))]) - -(documentation: /.and - "Short-circuiting 'and'." - [(and #1 #0) - "=>" - #0] - [(and #1 #1) - "=>" - #1]) - -(documentation: /.or - "Short-circuiting 'or'." - [(or #1 #0) - "=>" - #1] - [(or #0 #0) - "=>" - #0]) - -(documentation: /.panic! - "Causes an error, with the given error message." - [(panic! "OH NO!")]) - -(documentation: /.implementation - "Express a value that implements an interface." - [(is (Order Int) - (implementation - (def: equivalence - equivalence) - (def: (< reference subject) - (< reference subject)) - ))]) - -(documentation: /.Variant - (format "Syntax for defining labelled/tagged sum/union types." - \n "WARNING: Only use it within the type: macro.") - [(type: Referrals - (Variant - {#All} - {#Only (List Text)} - {#Exclude (List Text)} - {#Ignore} - {#Nothing}))]) - -(documentation: /.Record - (format "Syntax for defining labelled/slotted product/tuple types." - \n "WARNING: Only use it within the type: macro.") - [(type: Refer - (Record - [#refer_defs Referrals - #refer_open (List Openings)]))]) - -(documentation: /.type: - "The type-definition macro." - [(type: (List a) - {#End} - {#Item a (List a)})]) - -(documentation: /.Interface - "Interface definition." - [(type: .public (Order a) - (Interface - (is (Equivalence a) - equivalence) - (is (-> a a Bit) - <)))]) - -(.with_template [<name>] - [(documentation: <name> - "Safe type-casting for I64 values.")] - - [/.i64] - [/.nat] - [/.int] - [/.rev] - ) - -(documentation: /.module_separator - (format "Character used to separate the parts of module names." - \n "Value: " (%.text /.module_separator))) - -(documentation: /.open - (format "Same as the 'open' macro, but meant to be used as a pattern-matching macro for generating local bindings." - \n "Takes an 'alias' text for the generated local bindings.") - [(def: .public (range enum from to) - (All (_ a) (-> (Enum a) a a (List a))) - (let [(open "[0]") enum] - (loop (again [end to - output {.#End}]) - (cond (< end from) - (again (pred end) {.#Item end output}) - - (< from end) - (again (succ end) {.#Item end output}) - - ... (= end from) - {.#Item end output}))))]) - -(documentation: /.cond - "Conditional branching with multiple test conditions." - [(cond (even? num) "WHEN even" - (odd? num) "WHEN odd" - "ELSE")]) - -(documentation: /.the - "Accesses the value of a record at a given tag." - [(the #field my_record)] - ["Can also work with multiple levels of nesting." - (the [#foo #bar #baz] my_record)] - ["And, if only the slot/path is given, generates an accessor function." - (let [getter (the [#foo #bar #baz])] - (getter my_record))]) - -(documentation: /.open: - "Opens a implementation and generates a definition for each of its members (including nested members)." - [(open: "i:[0]" order) - "=>" - (def: i:= (at order =)) - (def: i:< (at order <))]) - -(documentation: /.|>> - "Similar to the piping macro, but rather than taking an initial object to work on, creates a function for taking it." - [(|>> (list#each int#encoded) - (interposed " ") - (mix text#composite "")) - "=>" - (function (_ <it>) - (mix text#composite "" - (interposed " " - (list#each int#encoded <it>))))]) - -(documentation: /.<<| - "Similar to the reverse piping macro, but rather than taking an initial object to work on, creates a function for taking it." - [(<<| (mix text#composite "") - (interposed " ") - (list#each int#encoded)) - "=>" - (function (_ <it>) - (mix text#composite "" - (interposed " " - (list#each int#encoded - <it>))))]) - -(documentation: /.using - "Module-definition macro." - [(.using - [lux (.except) - [control - ["M" monad (.except)]] - [data - maybe - ["[0]" name (.open: "[1]#[0]" codec)]] - [macro - code]] - [// - [type (.open: "[0]" equivalence)]])]) - -(documentation: /.# - "Allows accessing the value of a implementation's member." - [(at codec encoded)] - ["Also allows using that value as a function." - (at codec encoded +123)]) - -(documentation: /.has - "Sets the value of a record at a given tag." - [(has #name "Lux" lang)] - ["Can also work with multiple levels of nesting." - (has [#foo #bar #baz] value my_record)] - ["And, if only the slot/path and (optionally) the value are given, generates a mutator function." - (let [setter (has [#foo #bar #baz] value)] - (setter my_record)) - (let [setter (has [#foo #bar #baz])] - (setter value my_record))]) - -(documentation: /.revised - "Modifies the value of a record at a given tag, based on some function." - [(revised #age ++ person)] - ["Can also work with multiple levels of nesting." - (revised [#foo #bar #baz] func my_record)] - ["And, if only the slot/path and (optionally) the value are given, generates a mutator function." - (let [updater (revised [#foo #bar #baz] func)] - (updater my_record)) - (let [updater (revised [#foo #bar #baz])] - (updater func my_record))]) - -... (documentation: /.^template -... "It's similar to template, but meant to be used during pattern-matching." -... [(def: (reduced env type) -... (-> (List Type) Type Type) -... (case type -... {.#Primitive name params} -... {.#Primitive name (list#each (reduced env) params)} - -... (^with_template [<tag>] -... [{<tag> left right} -... {<tag> (reduced env left) (reduced env right)}]) -... ([.#Sum] [.#Product]) - -... (^with_template [<tag>] -... [{<tag> left right} -... {<tag> (reduced env left) (reduced env right)}]) -... ([.#Function] [.#Apply]) - -... (^with_template [<tag>] -... [{<tag> old_env def} -... (case old_env -... {.#End} -... {<tag> env def} - -... _ -... type)]) -... ([.#UnivQ] [.#ExQ]) - -... {.#Parameter idx} -... (else type (list.item idx env)) - -... _ -... type -... ))]) - -(.with_template [<name> <doc>] - [(documentation: <name> - <doc>)] - - [/.++ "Increment function."] - [/.-- "Decrement function."] - ) - -(documentation: /.loop - (format "Allows arbitrary looping, using the 'again' form to re-start the loop." - \n "Can be used in monadic code to create monadic loops.") - [(loop (again [count +0 - x init]) - (if (< +10 count) - (again (++ count) (f x)) - x))] - ["Loops can also be given custom names." - (loop (my_loop [count +0 - x init]) - (if (< +10 count) - (my_loop (++ count) (f x)) - x))]) - -(documentation: /.with_expansions - (format "Controlled macro-expansion." - \n "Bind an arbitraty number of Code nodes resulting from macro-expansion to local bindings." - \n "Wherever a binding appears, the bound Code nodes will be spliced in there.") - [(def: test - Test - (with_expansions - [<tests> (with_template [<function> <parameter> <expected>] - [(cover [<function>] - (compare <text> - (at codec encoded <function> <parameter>)))] - - [bit #1 "#1"] - [int +123 "+123"] - [frac +123.0 "+123.0"] - [text "123" "'123'"] - [symbol ["yolo" "lol"] "yolo.lol"] - [form (list (bit #1)) "(#1)"] - [tuple (list (bit #1)) "[#1]"] - )] - (all and - <tests> - )))]) - -(documentation: /.static - (format "Resolves the names of definitions to their values at compile-time, assuming their values are either:" - \n "* Bit" - \n "* Nat" - \n "* Int" - \n "* Rev" - \n "* Frac" - \n "* Text") - [(def: my_nat 123) - (def: my_text "456") - (and (case [my_nat my_text] - (pattern (static [..my_nat ..my_text])) - true - - _ - false) - (case [my_nat my_text] - (pattern [(static ..my_nat) (static ..my_text)]) - true - - _ - false))]) - -... (documentation: /.^multi -... (format "Multi-level pattern matching." -... \n "Useful in situations where the result of a branch depends on further refinements on the values being matched.") -... [(case (split (size static) uri) -... (^multi {#Some [chunk uri']} -... [(text#= static chunk) #1]) -... (match_uri endpoint? parts' uri') - -... _ -... {#Left (format "Static part " (%t static) " does not match URI: " uri)})] -... ["Short-cuts can be taken when using bit tests." -... "The example above can be rewritten as..." -... (case (split (size static) uri) -... (^multi {#Some [chunk uri']} -... (text#= static chunk)) -... (match_uri endpoint? parts' uri') - -... _ -... {#Left (format "Static part " (%t static) " does not match URI: " uri)})]) - -(documentation: /.symbol - "Gives back a 2 tuple with the module and name parts, both as Text." - [(symbol ..#doc) - "=>" - ["documentation/lux" "#doc"]]) - -(documentation: /.parameter - (format "WARNING: Please stay away from this macro; it's very likely to be removed in a future version of Lux." - "Allows you to refer to the type-variables in a polymorphic function's type, by their index.") - ["In the example below, 0 corresponds to the 'a' variable." - (def: .public (of_list list) - (All (_ a) (-> (List a) (Sequence a))) - (list#mix add - (is (Sequence (parameter 0)) - empty) - list))]) - -(documentation: /.same? - "Tests whether the 2 values are identical (not just 'equal')." - ["This one should succeed:" - (let [value +5] - (same? value - value))] - ["This one should fail:" - (same? +5 - (+ +2 +3))]) - -... (documentation: /.^let -... "Allows you to simultaneously bind and de-structure a value." -... [(def: (hash (^let set [member_hash _])) -... (list#mix (function (_ elem acc) -... (+ acc -... (at member_hash hash elem))) -... 0 -... (set.list set)))]) - -... (documentation: /.^|> -... "Pipes the value being pattern-matched against prior to binding it to a variable." -... [(case input -... (^|> value [++ (% 10) (max 1)]) -... (foo value))]) - -(documentation: /.as_expected - "Coerces the given expression to the type of whatever is expected." - [(is Dinosaur - (as_expected (is (List Nat) - (list 1 2 3))))]) - -(documentation: /.undefined - (format "Meant to be used as a stand-in for functions with undefined implementations." - \n "Undefined expressions will type-check against everything, so they make good dummy implementations." - \n "However, if an undefined expression is ever evaluated, it will raise a runtime error.") - [(def: (square x) - (-> Int Int) - (undefined))]) - -(documentation: /.type_of - "Generates the type corresponding to a given expression." - [(let [my_num +123] - (type_of my_num)) - "==" - Int] - [(type_of +123) - "==" - Int]) - -(documentation: /.template - (format "Define macros in the style of with_template." - \n "For simple macros that do not need any fancy features.") - [(def: square - (template (square x) - (* x x)))]) - -(documentation: /.these - (format "Given a (potentially empty) list of codes, just returns them immediately, without any work done." - \n "This may seen useless, but it has its utility when dealing with controlled-macro-expansion macros.") - [(with_expansions [<operands> (these 1 - 2 - 3 - 4)] - (all + <operands>))]) - -(documentation: /.char - "If given a 1-character text literal, yields the char-code of the sole character." - [(is Nat - (char "A")) - "=>" - 65]) - -(documentation: /.for - (format "Selects the appropriate code for a given target-platform when compiling Lux to it." - \n "Look-up the available targets in library/lux/target.") - [(def: js - "JavaScript") - - (for "JVM" (do jvm stuff) - js (do js stuff) - (do default stuff))]) - -(documentation: /.`` - (format "Delimits a controlled (spliced) macro-expansion." - \n "Uses a (~~) special form to specify where to expand.") - [(`` (some expression - (~~ (some macro which may yield 0 or more results))))]) - -... (documentation: /.^code -... "Generates pattern-matching code for Code values in a way that looks like code-templating." -... [(is (Maybe Nat) -... (case (` (#0 123 +456.789)) -... (^code (#0 (~ [_ {.#Nat number}]) +456.789)) -... {.#Some number} - -... _ -... {.#None}))]) - -(documentation: /.false - "The boolean FALSE value.") - -(documentation: /.true - "The boolean TRUE value.") - -(documentation: /.try - "" - [(is Foo - (case (is (Either Text Bar) - (try (is Bar - (risky computation which may panic)))) - {.#Right success} - (is Foo - (do something after success)) - - {.#Left error} - (is Foo - (recover from error))))]) + (documentation /.Location + "Locations are for specifying the location of Code nodes in Lux files during compilation.") -(.def: .public documentation - (.List $.Module) - ($.module /._ - "" - [..prelude - ..Any - ..Nothing - ..List - ..Bit - ..I64 - ..Nat - ..Int - ..Rev - ..Frac - ..Text - ..Symbol - ..Maybe - ..Type - ..Location - ..Ann - ..Code - ..private - ..local - ..public - ..global - ..Definition - ..Global - ..Either - ..Module - ..Mode - ..Info - ..Lux - ..Meta - ..Macro - ..comment - ..All - ..Ex - ..-> - ..list - ..Union - ..Tuple - ..Or - ..And - ..left - ..all - ..if - ..Primitive - ..` - ..`' - ..' - ..|> - ..<| - ..template - ..not - ..type - ..is - ..as - ..Rec - ..exec - ..case - ..pattern - ... ..^or - ..let - ..function - ..def: - ..macro - ..and - ..or - ..panic! - ..implementation - ..Variant - ..Record - ..type: - ..Interface - ..i64 - ..nat - ..int - ..rev - ..module_separator - ..open - ..cond - ..the - ..open: - ..|>> - ..<<| - ..using - ..# - ..has - ..revised - ... ..^template - ..++ - ..-- - ..loop - ..with_expansions - ..static - ... ..^multi - ..symbol - ..parameter - ..same? - ... ..^let - ... ..^|> - ..as_expected - ..undefined - ..type_of - ..template - ..these - ..char - ..for - ..`` - ... ..^code - ..false - ..true - ..try + (documentation (/.Ann meta_data datum) + "The type of things that can be annotated with meta-data of arbitrary types.") + + (documentation /.Code + "The type of Code nodes for Lux syntax.") + + (documentation /.private + "The export policy for private/local definitions.") + + (documentation /.local + "The export policy for private/local definitions.") + + (documentation /.public + "The export policy for public/global definitions.") + + (documentation /.global + "The export policy for public/global definitions.") + + (documentation /.Definition + "Represents all the data associated with a definition: its type, its annotations, and its value.") + + (documentation /.Global + "Represents all the data associated with a global constant.") + + (documentation (/.Either left right) + "A choice between two values of different types.") + + (documentation /.Module + "All the information contained within a Lux module.") + + (documentation /.Mode + "A sign that shows the conditions under which the compiler is running.") + + (documentation /.Info + "Information about the current version and type of compiler that is running.") + + (documentation /.Lux + (format "Represents the state of the Lux compiler during a run." + \n "It is provided to macros during their invocation, so they can access compiler data." + \n "Caveat emptor: Avoid fiddling with it, unless you know what you're doing.")) + + (documentation (/.Meta it) + (format "Computations that can have access to the state of the compiler." + \n "These computations may fail, or modify the state of the compiler.")) + + (documentation /.Macro + "Functions that run at compile-time and allow you to transform and extend the language in powerful ways.") + + (documentation /.comment + (format "Throws away any code given to it." + \n "Great for commenting-out code, while retaining syntax high-lighting and formatting in your text editor.") + [(comment + (def: (this will not) + (Be Defined) + (because it will be (commented out))))]) + + (documentation /.All + "Universal quantification." + [(All (_ a) + (-> a a))] + ["A name can be provided, to specify a recursive type." + (All (List a) + (Or Any + [a (List a)]))]) + + (documentation /.Ex + "Existential quantification." + [(Ex (_ a) + [(Codec Text a) a])] + ["A name can be provided, to specify a recursive type." + (Ex (Self a) + [(Codec Text a) + a + (List (Self a))])]) + + (documentation /.-> + "Function types." + ["This is the type of a function that takes 2 Ints and returns an Int." + (-> Int Int Int)]) + + (documentation /.list + "List literals." + [(is (List Nat) + (list 0 1 2 3))]) + + (documentation /.Union + "Union types." + [(Union Bit Nat Text)] + [(= Nothing + (Union))]) + + (documentation /.Tuple + "Tuple types." + [(Tuple Bit Nat Text)] + [(= Any + (Tuple))]) + + (documentation /.Or + "An alias for the Union type constructor." + [(= (Union Bit Nat Text) + (Or Bit Nat Text))] + [(= (Union) + (Or))]) + + (documentation /.And + "An alias for the Tuple type constructor." + [(= (Tuple Bit Nat Text) + (And Bit Nat Text))] + [(= (Tuple) + (And))]) + + (documentation /.left + "Left-association for the application of binary functions over variadic arguments." + [(left text#composite "Hello, " name ". How are you?") + "=>" + (text#composite (text#composite "Hello, " name) ". How are you?")]) + + (documentation /.all + "Right-association for the application of binary functions over variadic arguments." + [(all text#composite "Hello, " name ". How are you?") + "=>" + (text#composite "Hello, " (text#composite name ". How are you?"))]) + + (documentation /.if + "Picks which expression to evaluate based on a bit test value." + [(if #1 + "Oh, yeah!" + "Aw hell naw!") + "=>" + "Oh, yeah!"] + [(if #0 + "Oh, yeah!" + "Aw hell naw!") + "=>" + "Aw hell naw!"]) + + (documentation /.Primitive + "Macro to treat define new primitive types." + [(Primitive "java.lang.Object")] + [(Primitive "java.util.List" [(Primitive "java.lang.Long")])]) + + (documentation /.` + (format "Hygienic quasi-quotation as a macro." + \n "Unquote (~) and unquote-splice (~+) must also be used as forms." + \n "All unprefixed macros will receive their parent module's prefix if imported; otherwise will receive the prefix of the module on which the quasi-quote is being used.") + [(` (def: (~ name) + (function ((~' _) (~+ args)) + (~ body))))]) + + (documentation /.`' + (format "Unhygienic quasi-quotation as a macro." + \n "Unquote (~) and unquote-splice (~+) must also be used as forms.") + [(`' (def: (~ name) + (function (_ (~+ args)) + (~ body))))]) + + (documentation /.' + "Quotation as a macro." + [(' YOLO)]) + + (documentation /.|> + "Piping macro." + [(|> elems + (list#each int#encoded) + (interposed " ") + (mix text#composite "")) + "=>" + (mix text#composite "" + (interposed " " + (list#each int#encoded + elems)))]) + + (documentation /.<| + "Reverse piping macro." + [(<| (mix text#composite "") + (interposed " ") + (list#each int#encoded) + elems) + "=>" + (mix text#composite "" + (interposed " " + (list#each int#encoded + elems)))]) + + (documentation /.template + "" + ["By specifying a pattern (with holes), and the input data to fill those holes, repeats the pattern as many times as necessary." + (with_template [<name> <diff>] + [(def: .public <name> + (-> Int Int) + (+ <diff>))] + + [++ +1] + [-- -1] + )]) + + (documentation /.not + "Bit negation." + [(not #1) + "=>" + #0] + [(not #0) + "=>" + #1]) + + (documentation /.type + "Takes a type expression and returns its representation as data-structure." + [(type (All (_ a) + (Maybe (List a))))]) + + (documentation /.is + "The type-annotation macro." + [(is (List Int) + (list +1 +2 +3))]) + + (documentation /.as + "The type-coercion macro." + [(as Dinosaur + (list +1 +2 +3))]) + + (documentation /.Rec + "Parameter-less recursive types." + ["A name has to be given to the whole type, to use it within its body." + (Rec Int_List + (Or Any + [Int Int_List]))] + ["Can also be used with type: and labelled-type definitions." + (type: Type + (Rec @ + (Variant + {#Primitive Text (List @)} + {#Sum @ @} + {#Product @ @} + {#Function @ @} + {#Parameter Nat} + {#Var Nat} + {#Ex Nat} + {#UnivQ (List @) @} + {#ExQ (List @) @} + {#Apply @ @} + {#Named Symbol @})))]) + + (documentation /.exec + "Sequential execution of expressions (great for side-effects)." + [(exec + (log! "#1") + (log! "#2") + (log! "#3") + "YOLO")]) + + (documentation /.case + (format "The pattern-matching macro." + \n "Allows the usage of macros within the patterns to provide custom syntax.") + [(case (is (List Int) + (list +1 +2 +3)) + {#Item x {#Item y {#Item z {#End}}}} + {#Some (all * x y z)} + + _ + {#None})]) + + (documentation /.pattern + (format "Macro-expanding patterns." + \n "It's a special macro meant to be used with 'case'.") + [(case (is (List Int) + (list +1 +2 +3)) + (pattern (list x y z)) + {#Some (all * x y z)} + + _ + {#None})]) + + ... (documentation /.^or + ... (format "Or-patterns." + ... \n "It's a special macro meant to be used with 'case'.") + ... [(type: Weekday + ... (Variant + ... {#Monday} + ... {#Tuesday} + ... {#Wednesday} + ... {#Thursday} + ... {#Friday} + ... {#Saturday} + ... {#Sunday})) + + ... (def: (weekend? day) + ... (-> Weekday Bit) + ... (case day + ... (^or {#Saturday} {#Sunday}) + ... #1 + + ... _ + ... #0))]) + + (documentation /.let + (format "Creates local bindings." + \n "Can (optionally) use pattern-matching macros when binding.") + [(let [x (foo bar) + y (baz quux)] + (op x y))]) + + (documentation /.function + "Syntax for creating functions." + [(is (All (_ a b) + (-> a b a)) + (function (_ x y) + x))] + ["Allows for giving the function itself a name, for the sake of recursion." + (is (-> Nat Nat) + (function (factorial n) + (case n + 0 1 + _ (* n (factorial (-- n))))))]) + + (documentation /.def: + "Defines global constants/functions." + [(def: branching_exponent + Int + +5)] + ["The type is optional." + (def: branching_exponent + +5)] + [(def: (pair_list pair) + (-> [Code Code] (List Code)) + (let [[left right] pair] + (list left right)))] + ["Can pattern-match on the inputs to functions." + (def: (pair_list [left right]) + (-> [Code Code] (List Code)) + (list left right))]) + + (documentation /.macro + "Macro-definition macro." + [(def: .public symbol + (macro (_ tokens) + (case tokens + (^with_template [<tag>] + [(pattern (list [_ {<tag> [module name]}])) + (in (list (` [(~ (text$ module)) (~ (text$ name))])))]) + ([#Symbol]) + + _ + (failure "Wrong syntax for symbol"))))]) + + (documentation /.and + "Short-circuiting 'and'." + [(and #1 #0) + "=>" + #0] + [(and #1 #1) + "=>" + #1]) + + (documentation /.or + "Short-circuiting 'or'." + [(or #1 #0) + "=>" + #1] + [(or #0 #0) + "=>" + #0]) + + (documentation /.panic! + "Causes an error, with the given error message." + [(panic! "OH NO!")]) + + (documentation /.implementation + "Express a value that implements an interface." + [(is (Order Int) + (implementation + (def: equivalence + equivalence) + (def: (< reference subject) + (< reference subject)) + ))]) + + (documentation /.Variant + (format "Syntax for defining labelled/tagged sum/union types." + \n "WARNING: Only use it within the type: macro.") + [(type: Referrals + (Variant + {#All} + {#Only (List Text)} + {#Exclude (List Text)} + {#Ignore} + {#Nothing}))]) + + (documentation /.Record + (format "Syntax for defining labelled/slotted product/tuple types." + \n "WARNING: Only use it within the type: macro.") + [(type: Refer + (Record + [#refer_defs Referrals + #refer_open (List Openings)]))]) + + (documentation /.type: + "The type-definition macro." + [(type: (List a) + {#End} + {#Item a (List a)})]) + + (documentation /.Interface + "Interface definition." + [(type: .public (Order a) + (Interface + (is (Equivalence a) + equivalence) + (is (-> a a Bit) + <)))]) + + (.with_template [<name>] + [(documentation <name> + "Safe type-casting for I64 values.")] + + [/.i64] + [/.nat] + [/.int] + [/.rev] + ) + + (documentation /.module_separator + (format "Character used to separate the parts of module names." + \n "Value: " (%.text /.module_separator))) + + (documentation /.open + (format "Same as the 'open' macro, but meant to be used as a pattern-matching macro for generating local bindings." + \n "Takes an 'alias' text for the generated local bindings.") + [(def: .public (range enum from to) + (All (_ a) (-> (Enum a) a a (List a))) + (let [(open "[0]") enum] + (loop (again [end to + output {.#End}]) + (cond (< end from) + (again (pred end) {.#Item end output}) + + (< from end) + (again (succ end) {.#Item end output}) + + ... (= end from) + {.#Item end output}))))]) + + (documentation /.cond + "Conditional branching with multiple test conditions." + [(cond (even? num) "WHEN even" + (odd? num) "WHEN odd" + "ELSE")]) + + (documentation /.the + "Accesses the value of a record at a given tag." + [(the #field my_record)] + ["Can also work with multiple levels of nesting." + (the [#foo #bar #baz] my_record)] + ["And, if only the slot/path is given, generates an accessor function." + (let [getter (the [#foo #bar #baz])] + (getter my_record))]) + + (documentation /.open: + "Opens a implementation and generates a definition for each of its members (including nested members)." + [(open: "i:[0]" order) + "=>" + (def: i:= (at order =)) + (def: i:< (at order <))]) + + (documentation /.|>> + "Similar to the piping macro, but rather than taking an initial object to work on, creates a function for taking it." + [(|>> (list#each int#encoded) + (interposed " ") + (mix text#composite "")) + "=>" + (function (_ <it>) + (mix text#composite "" + (interposed " " + (list#each int#encoded <it>))))]) + + (documentation /.<<| + "Similar to the reverse piping macro, but rather than taking an initial object to work on, creates a function for taking it." + [(<<| (mix text#composite "") + (interposed " ") + (list#each int#encoded)) + "=>" + (function (_ <it>) + (mix text#composite "" + (interposed " " + (list#each int#encoded + <it>))))]) + + (documentation /.using + "Module-definition macro." + [(.using + [lux (.except) + [control + ["M" monad (.except)]] + [data + maybe + ["[0]" name (.open: "[1]#[0]" codec)]] + [macro + code]] + [// + [type (.open: "[0]" equivalence)]])]) + + (documentation /.# + "Allows accessing the value of a implementation's member." + [(at codec encoded)] + ["Also allows using that value as a function." + (at codec encoded +123)]) + + (documentation /.has + "Sets the value of a record at a given tag." + [(has #name "Lux" lang)] + ["Can also work with multiple levels of nesting." + (has [#foo #bar #baz] value my_record)] + ["And, if only the slot/path and (optionally) the value are given, generates a mutator function." + (let [setter (has [#foo #bar #baz] value)] + (setter my_record)) + (let [setter (has [#foo #bar #baz])] + (setter value my_record))]) + + (documentation /.revised + "Modifies the value of a record at a given tag, based on some function." + [(revised #age ++ person)] + ["Can also work with multiple levels of nesting." + (revised [#foo #bar #baz] func my_record)] + ["And, if only the slot/path and (optionally) the value are given, generates a mutator function." + (let [updater (revised [#foo #bar #baz] func)] + (updater my_record)) + (let [updater (revised [#foo #bar #baz])] + (updater func my_record))]) + + ... (documentation /.^template + ... "It's similar to template, but meant to be used during pattern-matching." + ... [(def: (reduced env type) + ... (-> (List Type) Type Type) + ... (case type + ... {.#Primitive name params} + ... {.#Primitive name (list#each (reduced env) params)} + + ... (^with_template [<tag>] + ... [{<tag> left right} + ... {<tag> (reduced env left) (reduced env right)}]) + ... ([.#Sum] [.#Product]) + + ... (^with_template [<tag>] + ... [{<tag> left right} + ... {<tag> (reduced env left) (reduced env right)}]) + ... ([.#Function] [.#Apply]) + + ... (^with_template [<tag>] + ... [{<tag> old_env def} + ... (case old_env + ... {.#End} + ... {<tag> env def} + + ... _ + ... type)]) + ... ([.#UnivQ] [.#ExQ]) + + ... {.#Parameter idx} + ... (else type (list.item idx env)) + + ... _ + ... type + ... ))]) + + (.with_template [<name> <doc>] + [(documentation <name> + <doc>)] + + [/.++ "Increment function."] + [/.-- "Decrement function."] + ) + + (documentation /.loop + (format "Allows arbitrary looping, using the 'again' form to re-start the loop." + \n "Can be used in monadic code to create monadic loops.") + [(loop (again [count +0 + x init]) + (if (< +10 count) + (again (++ count) (f x)) + x))] + ["Loops can also be given custom names." + (loop (my_loop [count +0 + x init]) + (if (< +10 count) + (my_loop (++ count) (f x)) + x))]) + + (documentation /.with_expansions + (format "Controlled macro-expansion." + \n "Bind an arbitraty number of Code nodes resulting from macro-expansion to local bindings." + \n "Wherever a binding appears, the bound Code nodes will be spliced in there.") + [(def: test + Test + (with_expansions + [<tests> (with_template [<function> <parameter> <expected>] + [(cover [<function>] + (compare <text> + (at codec encoded <function> <parameter>)))] + + [bit #1 "#1"] + [int +123 "+123"] + [frac +123.0 "+123.0"] + [text "123" "'123'"] + [symbol ["yolo" "lol"] "yolo.lol"] + [form (list (bit #1)) "(#1)"] + [tuple (list (bit #1)) "[#1]"] + )] + (all and + <tests> + )))]) + + (documentation /.static + (format "Resolves the names of definitions to their values at compile-time, assuming their values are either:" + \n "* Bit" + \n "* Nat" + \n "* Int" + \n "* Rev" + \n "* Frac" + \n "* Text") + [(def: my_nat 123) + (def: my_text "456") + (and (case [my_nat my_text] + (pattern (static [..my_nat ..my_text])) + true + + _ + false) + (case [my_nat my_text] + (pattern [(static ..my_nat) (static ..my_text)]) + true + + _ + false))]) + + ... (documentation /.^multi + ... (format "Multi-level pattern matching." + ... \n "Useful in situations where the result of a branch depends on further refinements on the values being matched.") + ... [(case (split (size static) uri) + ... (^multi {#Some [chunk uri']} + ... [(text#= static chunk) #1]) + ... (match_uri endpoint? parts' uri') + + ... _ + ... {#Left (format "Static part " (%t static) " does not match URI: " uri)})] + ... ["Short-cuts can be taken when using bit tests." + ... "The example above can be rewritten as..." + ... (case (split (size static) uri) + ... (^multi {#Some [chunk uri']} + ... (text#= static chunk)) + ... (match_uri endpoint? parts' uri') + + ... _ + ... {#Left (format "Static part " (%t static) " does not match URI: " uri)})]) + + (documentation /.symbol + "Gives back a 2 tuple with the module and name parts, both as Text." + [(symbol ..#doc) + "=>" + ["documentation/lux" "#doc"]]) + + (documentation /.parameter + (format "WARNING: Please stay away from this macro; it's very likely to be removed in a future version of Lux." + "Allows you to refer to the type-variables in a polymorphic function's type, by their index.") + ["In the example below, 0 corresponds to the 'a' variable." + (def: .public (of_list list) + (All (_ a) (-> (List a) (Sequence a))) + (list#mix add + (is (Sequence (parameter 0)) + empty) + list))]) + + (documentation /.same? + "Tests whether the 2 values are identical (not just 'equal')." + ["This one should succeed:" + (let [value +5] + (same? value + value))] + ["This one should fail:" + (same? +5 + (+ +2 +3))]) + + ... (documentation /.^let + ... "Allows you to simultaneously bind and de-structure a value." + ... [(def: (hash (^let set [member_hash _])) + ... (list#mix (function (_ elem acc) + ... (+ acc + ... (at member_hash hash elem))) + ... 0 + ... (set.list set)))]) + + ... (documentation /.^|> + ... "Pipes the value being pattern-matched against prior to binding it to a variable." + ... [(case input + ... (^|> value [++ (% 10) (max 1)]) + ... (foo value))]) + + (documentation /.as_expected + "Coerces the given expression to the type of whatever is expected." + [(is Dinosaur + (as_expected (is (List Nat) + (list 1 2 3))))]) + + (documentation /.undefined + (format "Meant to be used as a stand-in for functions with undefined implementations." + \n "Undefined expressions will type-check against everything, so they make good dummy implementations." + \n "However, if an undefined expression is ever evaluated, it will raise a runtime error.") + [(def: (square x) + (-> Int Int) + (undefined))]) + + (documentation /.type_of + "Generates the type corresponding to a given expression." + [(let [my_num +123] + (type_of my_num)) + "==" + Int] + [(type_of +123) + "==" + Int]) + + (documentation /.template + (format "Define macros in the style of with_template." + \n "For simple macros that do not need any fancy features.") + [(def: square + (template (square x) + (* x x)))]) + + (documentation /.these + (format "Given a (potentially empty) list of codes, just returns them immediately, without any work done." + \n "This may seen useless, but it has its utility when dealing with controlled-macro-expansion macros.") + [(with_expansions [<operands> (these 1 + 2 + 3 + 4)] + (all + <operands>))]) + + (documentation /.char + "If given a 1-character text literal, yields the char-code of the sole character." + [(is Nat + (char "A")) + "=>" + 65]) + + (documentation /.for + (format "Selects the appropriate code for a given target-platform when compiling Lux to it." + \n "Look-up the available targets in library/lux/target.") + [(def: js + "JavaScript") + + (for "JVM" (do jvm stuff) + js (do js stuff) + (do default stuff))]) + + (documentation /.`` + (format "Delimits a controlled (spliced) macro-expansion." + \n "Uses a (~~) special form to specify where to expand.") + [(`` (some expression + (~~ (some macro which may yield 0 or more results))))]) + + ... (documentation /.^code + ... "Generates pattern-matching code for Code values in a way that looks like code-templating." + ... [(is (Maybe Nat) + ... (case (` (#0 123 +456.789)) + ... (^code (#0 (~ [_ {.#Nat number}]) +456.789)) + ... {.#Some number} + + ... _ + ... {.#None}))]) + + (documentation /.false + "The boolean FALSE value.") + + (documentation /.true + "The boolean TRUE value.") + + (documentation /.try + "" + [(is Foo + (case (is (Either Text Bar) + (try (is Bar + (risky computation which may panic)))) + {.#Right success} + (is Foo + (do something after success)) + + {.#Left error} + (is Foo + (recover from error))))]) + ($.default (/.Code' w)) ($.default /.Alias) ($.default (/.Bindings key value)) @@ -1023,4 +914,4 @@ /world.documentation])) (program: inputs - (io.io (debug.log! ($.documentation ..documentation)))) + (io.io (debug.log! ($.markdown ..documentation)))) diff --git a/stdlib/source/documentation/lux/type/primitive.lux b/stdlib/source/documentation/lux/type/primitive.lux index fd9370972..cbb9ac7bf 100644 --- a/stdlib/source/documentation/lux/type/primitive.lux +++ b/stdlib/source/documentation/lux/type/primitive.lux @@ -35,10 +35,10 @@ [/.representation Abstraction representation Representation] ) -(documentation: /.primitive: +(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 + [(primitive String Text (def: (string value) @@ -49,21 +49,21 @@ (-> String Text) (representation value)))] ["Type-parameters are optional." - (primitive: (Duplicate a) + (primitive (Duplicate a) [a a] (def: (duplicate value) (All (_ a) (-> a (Duplicate a))) (abstraction [value value])))] ["Definitions can be nested." - (primitive: (Single a) + (primitive (Single a) a (def: (single value) (All (_ a) (-> a (Single a))) (abstraction value)) - (primitive: (Double a) + (primitive (Double a) [a a] (def: (double value) @@ -83,11 +83,11 @@ 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) + (primitive (JavaScript a) Text - (primitive: Expression Any) - (primitive: Statement Any) + (primitive Expression Any) + (primitive Statement Any) (def: (+ x y) (-> (JavaScript Expression) (JavaScript Expression) (JavaScript Expression)) @@ -103,11 +103,11 @@ (documentation: /.transmutation "Transmutes an abstract/nominal type's phantom types." - [(primitive: (JavaScript a) + [(primitive (JavaScript a) Text - (primitive: Expression Any) - (primitive: Statement Any) + (primitive Expression Any) + (primitive Statement Any) (def: (statement expression) (-> (JavaScript Expression) (JavaScript Statement)) @@ -126,7 +126,7 @@ ..specific ..abstraction ..representation - ..primitive: + ..primitive ..transmutation ($.default /.no_active_frames)] [])) diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux index 55534dfab..fc2033517 100644 --- a/stdlib/source/library/lux/control/concurrency/actor.lux +++ b/stdlib/source/library/lux/control/concurrency/actor.lux @@ -14,7 +14,7 @@ [macro ["[0]" local]] [type (.only sharing) - [primitive (.only primitive: representation abstraction)]]]] + [primitive (.only primitive representation abstraction)]]]] [// ["[0]" atom (.only Atom atom)] ["[0]" async (.only Async Resolver)] @@ -47,7 +47,7 @@ {.#None} (in {.#End})))) - (primitive: .public (Actor s) + (primitive .public (Actor s) (Record [#obituary [(Async (<Obituary> Actor s)) (Resolver (<Obituary> Actor s))] diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux index 0770db384..20fabdb3b 100644 --- a/stdlib/source/library/lux/control/concurrency/async.lux +++ b/stdlib/source/library/lux/control/concurrency/async.lux @@ -21,7 +21,7 @@ ["[0]" thread] ["[0]" atom (.only Atom atom)]]) -(primitive: .public (Async'' a) +(primitive .public (Async'' a) (Atom [(Maybe a) (List (-> a (IO Any)))]) (type: .public (Async' r w) diff --git a/stdlib/source/library/lux/control/concurrency/atom.lux b/stdlib/source/library/lux/control/concurrency/atom.lux index e14e86c01..86399e1a6 100644 --- a/stdlib/source/library/lux/control/concurrency/atom.lux +++ b/stdlib/source/library/lux/control/concurrency/atom.lux @@ -26,7 +26,7 @@ @.jvm <jvm> (these))) -(primitive: .public (Atom'' a) +(primitive .public (Atom'' a) (with_expansions [<jvm> (java/util/concurrent/atomic/AtomicReference a)] (for @.old <jvm> @.jvm <jvm> diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux index 3c6deadeb..5cf050d4b 100644 --- a/stdlib/source/library/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux @@ -30,7 +30,7 @@ #open_positions Int #waiting_list (Queue (Resolver Any))])) -(primitive: .public Semaphore +(primitive .public Semaphore (Atom State) (def: most_positions_possible @@ -94,7 +94,7 @@ (in {try.#Success (the #open_positions post)}))))))) ) -(primitive: .public Mutex +(primitive .public Mutex Semaphore (def: .public (mutex _) @@ -124,7 +124,7 @@ (type: .public Limit (~ (refinement.type limit))) -(primitive: .public Barrier +(primitive .public Barrier (Record [#limit Limit #count (Atom Nat) diff --git a/stdlib/source/library/lux/control/concurrency/stm.lux b/stdlib/source/library/lux/control/concurrency/stm.lux index 3d16d8338..c5323c442 100644 --- a/stdlib/source/library/lux/control/concurrency/stm.lux +++ b/stdlib/source/library/lux/control/concurrency/stm.lux @@ -26,7 +26,7 @@ (type: (Observer a) (-> a (IO Any))) -(primitive: .public (Var'' a) +(primitive .public (Var'' a) (Atom [a (List (Sink a))]) (type: .public (Var' r w) diff --git a/stdlib/source/library/lux/control/io.lux b/stdlib/source/library/lux/control/io.lux index a942a7c80..0b2372c6b 100644 --- a/stdlib/source/library/lux/control/io.lux +++ b/stdlib/source/library/lux/control/io.lux @@ -14,7 +14,7 @@ [syntax (.only syntax)] ["[0]" template]]]]) -(primitive: .public (IO a) +(primitive .public (IO a) (-> Any a) (def: label diff --git a/stdlib/source/library/lux/control/lazy.lux b/stdlib/source/library/lux/control/lazy.lux index 62baa0ec1..c96a5f569 100644 --- a/stdlib/source/library/lux/control/lazy.lux +++ b/stdlib/source/library/lux/control/lazy.lux @@ -17,7 +17,7 @@ [type (.only sharing) [primitive (.except)]]]]) -(primitive: .public (Lazy a) +(primitive .public (Lazy a) (-> [] a) (def: (lazy' generator) diff --git a/stdlib/source/library/lux/control/security/capability.lux b/stdlib/source/library/lux/control/security/capability.lux index 90c98a89e..482f61161 100644 --- a/stdlib/source/library/lux/control/security/capability.lux +++ b/stdlib/source/library/lux/control/security/capability.lux @@ -23,7 +23,7 @@ ["|[0]|" export] ["|[0]|" declaration]]]]]) -(primitive: .public (Capability brand input output) +(primitive .public (Capability brand input output) (-> input output) (def: capability diff --git a/stdlib/source/library/lux/control/security/policy.lux b/stdlib/source/library/lux/control/security/policy.lux index 2328915f6..f8856c593 100644 --- a/stdlib/source/library/lux/control/security/policy.lux +++ b/stdlib/source/library/lux/control/security/policy.lux @@ -8,7 +8,7 @@ [type [primitive (.except)]]]]) -(primitive: .public (Policy brand value label) +(primitive .public (Policy brand value label) value (type: .public (Can_Upgrade brand label value) @@ -77,7 +77,7 @@ ) (with_template [<brand> <value> <upgrade> <downgrade>] - [(primitive: .public <brand> + [(primitive .public <brand> Any (type: .public <value> diff --git a/stdlib/source/library/lux/control/thread.lux b/stdlib/source/library/lux/control/thread.lux index 2725e4a84..bb48b31b0 100644 --- a/stdlib/source/library/lux/control/thread.lux +++ b/stdlib/source/library/lux/control/thread.lux @@ -19,7 +19,7 @@ (type: .public (Thread ! a) (-> ! a)) -(primitive: .public (Box'' t a) +(primitive .public (Box'' t a) (Array a) (type: .public (Box' t r w) diff --git a/stdlib/source/library/lux/data/collection/queue/priority.lux b/stdlib/source/library/lux/data/collection/queue/priority.lux index f62ff3c6a..2cf313bec 100644 --- a/stdlib/source/library/lux/data/collection/queue/priority.lux +++ b/stdlib/source/library/lux/data/collection/queue/priority.lux @@ -14,7 +14,7 @@ [number ["n" nat (.open: "[1]#[0]" interval)]]] [type (.only by_example) - [primitive (.only primitive: abstraction representation)]]]]) + [primitive (.only primitive abstraction representation)]]]]) (type: .public Priority Nat) @@ -37,7 +37,7 @@ @)) -(primitive: .public (Queue a) +(primitive .public (Queue a) (Maybe (Tree :@: Priority a)) (def: .public empty diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux index f43c6fa10..3e63b2926 100644 --- a/stdlib/source/library/lux/data/collection/set/multi.lux +++ b/stdlib/source/library/lux/data/collection/set/multi.lux @@ -14,13 +14,13 @@ [number ["n" nat]]] [type - ["[0]" primitive (.only primitive: abstraction representation)]]]] + ["[0]" primitive (.only primitive abstraction representation)]]]] ["[0]" // (.only) [// ["[0]" list (.open: "[1]#[0]" mix monoid)] ["[0]" dictionary (.only Dictionary)]]]) -(primitive: .public (Set a) +(primitive .public (Set a) (Dictionary a Nat) (def: .public empty diff --git a/stdlib/source/library/lux/data/collection/set/ordered.lux b/stdlib/source/library/lux/data/collection/set/ordered.lux index 30fab5b6a..c876afca0 100644 --- a/stdlib/source/library/lux/data/collection/set/ordered.lux +++ b/stdlib/source/library/lux/data/collection/set/ordered.lux @@ -12,7 +12,7 @@ [type [primitive (.except)]]]]) -(primitive: .public (Set a) +(primitive .public (Set a) (/.Dictionary a a) (def: .public empty diff --git a/stdlib/source/library/lux/data/collection/stack.lux b/stdlib/source/library/lux/data/collection/stack.lux index baf2bf038..086b727ca 100644 --- a/stdlib/source/library/lux/data/collection/stack.lux +++ b/stdlib/source/library/lux/data/collection/stack.lux @@ -10,7 +10,7 @@ [type [primitive (.except)]]]]) -(primitive: .public (Stack a) +(primitive .public (Stack a) (List a) (def: .public empty diff --git a/stdlib/source/library/lux/data/collection/tree/finger.lux b/stdlib/source/library/lux/data/collection/tree/finger.lux index b316d4dc5..0d8527308 100644 --- a/stdlib/source/library/lux/data/collection/tree/finger.lux +++ b/stdlib/source/library/lux/data/collection/tree/finger.lux @@ -8,10 +8,10 @@ [collection ["[0]" list (.open: "[1]#[0]" monoid)]]] [type - [primitive (.only primitive: abstraction representation)]]]]) + [primitive (.only primitive abstraction representation)]]]]) ... https://en.wikipedia.org/wiki/Finger_tree -(primitive: .public (Tree @ t v) +(primitive .public (Tree @ t v) (Record [#monoid (Monoid t) #tag t diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux index c6d5126f0..2a89c02fe 100644 --- a/stdlib/source/library/lux/data/color.lux +++ b/stdlib/source/library/lux/data/color.lux @@ -51,7 +51,7 @@ (type: .public HSB [Frac Frac Frac]) -(primitive: .public Color +(primitive .public Color RGB (def: .public (of_rgb [red green blue]) diff --git a/stdlib/source/library/lux/data/format/css.lux b/stdlib/source/library/lux/data/format/css.lux index cbbc587c7..df39b6b61 100644 --- a/stdlib/source/library/lux/data/format/css.lux +++ b/stdlib/source/library/lux/data/format/css.lux @@ -24,10 +24,10 @@ ["[1][0]" style] ["[1][0]" query (.only Query)]]) -(primitive: .public Common Any) -(primitive: .public Special Any) +(primitive .public Common Any) +(primitive .public Special Any) -(primitive: .public (CSS brand) +(primitive .public (CSS brand) Text (def: .public css diff --git a/stdlib/source/library/lux/data/format/css/class.lux b/stdlib/source/library/lux/data/format/css/class.lux index 13fec00a4..1fb58b4d7 100644 --- a/stdlib/source/library/lux/data/format/css/class.lux +++ b/stdlib/source/library/lux/data/format/css/class.lux @@ -13,7 +13,7 @@ [type [primitive (.except)]]]]) -(primitive: .public Class +(primitive .public Class Text (def: .public class diff --git a/stdlib/source/library/lux/data/format/css/id.lux b/stdlib/source/library/lux/data/format/css/id.lux index 00f094c1a..2ba540356 100644 --- a/stdlib/source/library/lux/data/format/css/id.lux +++ b/stdlib/source/library/lux/data/format/css/id.lux @@ -13,7 +13,7 @@ [type [primitive (.except)]]]]) -(primitive: .public ID +(primitive .public ID Text (def: .public id diff --git a/stdlib/source/library/lux/data/format/css/property.lux b/stdlib/source/library/lux/data/format/css/property.lux index 9361d2d4a..21348e82d 100644 --- a/stdlib/source/library/lux/data/format/css/property.lux +++ b/stdlib/source/library/lux/data/format/css/property.lux @@ -58,7 +58,7 @@ (syntax (_ [symbol s.text]) (in (list (code.local (text.replaced "-" "_" symbol)))))) -(primitive: .public (Property brand) +(primitive .public (Property brand) Text (def: .public name diff --git a/stdlib/source/library/lux/data/format/css/query.lux b/stdlib/source/library/lux/data/format/css/query.lux index ea280933c..f4d2fccd5 100644 --- a/stdlib/source/library/lux/data/format/css/query.lux +++ b/stdlib/source/library/lux/data/format/css/query.lux @@ -25,7 +25,7 @@ (syntax (_ [symbol s.text]) (in (list (code.local (text.replaced "-" "_" symbol)))))) -(primitive: .public Media +(primitive .public Media Text (def: .public media @@ -43,7 +43,7 @@ ["speech"] )) -(primitive: .public Feature +(primitive .public Feature Text (def: .public feature @@ -103,7 +103,7 @@ ) ) -(primitive: .public Query +(primitive .public Query Text (def: .public query diff --git a/stdlib/source/library/lux/data/format/css/selector.lux b/stdlib/source/library/lux/data/format/css/selector.lux index ad025e3e9..2fe5ae11e 100644 --- a/stdlib/source/library/lux/data/format/css/selector.lux +++ b/stdlib/source/library/lux/data/format/css/selector.lux @@ -21,21 +21,21 @@ (type: .public Tag Label) (type: .public Attribute Label) -(primitive: .public (Generic brand) Any) +(primitive .public (Generic brand) Any) (with_template [<generic> <brand>] - [(primitive: <brand> Any) + [(primitive <brand> Any) (type: .public <generic> (Generic <brand>))] [Can_Chain Can_Chain'] [Cannot_Chain Cannot_Chain'] ) -(primitive: .public Unique Any) -(primitive: .public Specific Any) -(primitive: .public Composite Any) +(primitive .public Unique Any) +(primitive .public Specific Any) +(primitive .public Composite Any) -(primitive: .public (Selector kind) +(primitive .public (Selector kind) Text (def: .public selector @@ -167,7 +167,7 @@ (format ":not") abstraction)) - (primitive: .public Index + (primitive .public Index Text (def: .public index diff --git a/stdlib/source/library/lux/data/format/css/style.lux b/stdlib/source/library/lux/data/format/css/style.lux index 35348d5e7..eba1e112d 100644 --- a/stdlib/source/library/lux/data/format/css/style.lux +++ b/stdlib/source/library/lux/data/format/css/style.lux @@ -12,7 +12,7 @@ ["[1][0]" value (.only Value)] ["[1][0]" property (.only Property)]]) -(primitive: .public Style +(primitive .public Style Text (def: .public empty diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux index e2bf08a20..66c82fe50 100644 --- a/stdlib/source/library/lux/data/format/css/value.lux +++ b/stdlib/source/library/lux/data/format/css/value.lux @@ -35,7 +35,7 @@ (def: enumeration (template (_ <abstraction> <representation> <out> <sample>+ <definition>+) - [(primitive: .public <abstraction> + [(primitive .public <abstraction> <representation> (def: .public <out> @@ -57,7 +57,7 @@ raw (|> raw (text.split_at 1) maybe.trusted product.right)))) -(primitive: .public (Value brand) +(primitive .public (Value brand) Text (def: .public value @@ -72,11 +72,11 @@ [unset "unset"] ) - (primitive: .public (Numeric kind) Any) + (primitive .public (Numeric kind) Any) (with_template [<name>] [(with_expansions [<name>' (template.symbol [<name> "'"])] - (primitive: .public <name>' Any) + (primitive .public <name>' Any) (type: .public <name> (Numeric <name>')))] @@ -87,7 +87,7 @@ ) (with_template [<brand> <alias>+ <value>+] - [(primitive: .public <brand> Any) + [(primitive .public <brand> Any) (`` (with_template [<name> <value>] [(def: .public <name> @@ -889,7 +889,7 @@ (abstraction (format (%.nat horizontal) ..slice_separator (%.nat vertical)))) - (primitive: .public Stop + (primitive .public Stop Text (def: .public stop @@ -909,7 +909,7 @@ (representation Value start) ..stop_separator (representation Value end)))) - (primitive: .public Hint + (primitive .public Hint Text (def: .public hint @@ -928,7 +928,7 @@ (type: .public (List/1 a) [a (List a)]) - (primitive: .public Angle + (primitive .public Angle Text (def: .public angle diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux index 50b4d8de5..3a8bcd5c6 100644 --- a/stdlib/source/library/lux/data/format/html.lux +++ b/stdlib/source/library/lux/data/format/html.lux @@ -79,11 +79,11 @@ (-> Tag Text) (text.enclosed ["</" ">"])) -(primitive: .public (HTML brand) +(primitive .public (HTML brand) Text (.with_template [<name> <brand>] - [(primitive: <brand> Any) + [(primitive <brand> Any) (type: .public <name> (HTML <brand>))] [Meta Meta'] @@ -101,11 +101,11 @@ ) (.with_template [<super> <super_raw> <sub>+] - [(primitive: (<super_raw> brand) Any) + [(primitive (<super_raw> brand) Any) (type: .public <super> (HTML (<super_raw> Any))) (`` (.with_template [<sub> <sub_raw>] - [(primitive: <sub_raw> Any) + [(primitive <sub_raw> Any) (type: .public <sub> (HTML (<super_raw> <sub_raw>)))] (~~ (template.spliced <sub>+))))] diff --git a/stdlib/source/library/lux/data/format/markdown.lux b/stdlib/source/library/lux/data/format/markdown.lux index 1e2673a85..d65c5e6f6 100644 --- a/stdlib/source/library/lux/data/format/markdown.lux +++ b/stdlib/source/library/lux/data/format/markdown.lux @@ -31,10 +31,10 @@ (text.replaced "." "\.") (text.replaced "!" "\!"))) -(primitive: .public Span Any) -(primitive: .public Block Any) +(primitive .public Span Any) +(primitive .public Block Any) -(primitive: .public (Markdown brand) +(primitive .public (Markdown brand) Text (def: .public empty diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux index 1c75474cf..272d666de 100644 --- a/stdlib/source/library/lux/data/format/tar.lux +++ b/stdlib/source/library/lux/data/format/tar.lux @@ -75,7 +75,7 @@ "Value" (%.nat value) "Maximum" (%.nat (-- <limit>)))) - (primitive: .public <type> + (primitive .public <type> Nat (def: .public (<in> value) @@ -160,7 +160,7 @@ [value (at n.octal decoded digits)] (..big value))))) -(primitive: Checksum +(primitive Checksum Text (def: from_checksum @@ -249,7 +249,7 @@ (binary!.slice 0 (++ end) string)))))))) (with_template [<type> <representation> <size> <exception> <in> <out> <writer> <parser> <none>] - [(primitive: .public <type> + [(primitive .public <type> <representation> (exception: .public (<exception> [value Text]) @@ -306,7 +306,7 @@ (def: magic_size Size 7) -(primitive: Magic +(primitive Magic Text (def: ustar @@ -393,7 +393,7 @@ ... devminor (..small_number ..device_size))) -(primitive: Link_Flag +(primitive Link_Flag Char (def: link_flag @@ -441,7 +441,7 @@ (exception.except ..invalid_link_flag [(.nat it)])))))) ) -(primitive: .public Mode +(primitive .public Mode Nat (def: .public mode @@ -529,7 +529,7 @@ (list.repeated ..content_size) (list#mix n.* 1))) -(primitive: .public Content +(primitive .public Content [Big Binary] (def: .public (content content) diff --git a/stdlib/source/library/lux/data/text/buffer.lux b/stdlib/source/library/lux/data/text/buffer.lux index 4559e04dd..a099758f5 100644 --- a/stdlib/source/library/lux/data/text/buffer.lux +++ b/stdlib/source/library/lux/data/text/buffer.lux @@ -48,7 +48,7 @@ ) (these)))) -(`` (primitive: .public Buffer +(`` (primitive .public Buffer (for @.old [Nat (-> java/lang/StringBuilder java/lang/StringBuilder)] @.jvm [Nat (-> java/lang/StringBuilder java/lang/StringBuilder)] @.js [Nat (-> (JS_Array Text) (JS_Array Text))] diff --git a/stdlib/source/library/lux/data/text/encoding.lux b/stdlib/source/library/lux/data/text/encoding.lux index da140a7e1..2863d9623 100644 --- a/stdlib/source/library/lux/data/text/encoding.lux +++ b/stdlib/source/library/lux/data/text/encoding.lux @@ -7,7 +7,7 @@ [primitive (.except)]]]]) ... https://en.wikipedia.org/wiki/Character_encoding#Common_character_encodings -(primitive: .public Encoding +(primitive .public Encoding Text (with_template [<name> <encoding>] diff --git a/stdlib/source/library/lux/data/text/unicode/block.lux b/stdlib/source/library/lux/data/text/unicode/block.lux index a95c2ad0a..7f3eeb32d 100644 --- a/stdlib/source/library/lux/data/text/unicode/block.lux +++ b/stdlib/source/library/lux/data/text/unicode/block.lux @@ -14,7 +14,7 @@ [primitive (.except)]]]] [/// (.only Char)]) -(primitive: .public Block +(primitive .public Block (Interval Char) (def: .public monoid diff --git a/stdlib/source/library/lux/data/text/unicode/set.lux b/stdlib/source/library/lux/data/text/unicode/set.lux index 92a575201..fdbf1955a 100644 --- a/stdlib/source/library/lux/data/text/unicode/set.lux +++ b/stdlib/source/library/lux/data/text/unicode/set.lux @@ -26,7 +26,7 @@ @)) -(primitive: .public Set +(primitive .public Set (Tree :@: Block []) (def: .public (composite left right) diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux index 9b1e70af6..abe8d3ff3 100644 --- a/stdlib/source/library/lux/documentation.lux +++ b/stdlib/source/library/lux/documentation.lux @@ -583,24 +583,29 @@ (def: .public default (syntax (_ [[name parameters] ..declaration]) - (let [[_ short] name] - (in (list (` (is (.List ..Definition) - (list [..#definition (~ (code.text short)) - ..#documentation ((~! ..minimal_definition_documentation) - ((~ (code.symbol name)) - (~+ (list#each code.local parameters))))])))))))) - -(def: .public documentation: + (macro.with_symbols [g!_] + (let [[_ short] name] + (in (list (` (.let [(~ g!_) (.is (.-> .Any (.List ..Definition)) + (.function ((~ g!_) (~ g!_)) + (.list [..#definition (~ (code.text short)) + ..#documentation ((~! ..minimal_definition_documentation) + ((~ (code.symbol name)) + (~+ (list#each code.local parameters))))])))] + ((~ g!_) []))))))))) + +(def: .public documentation (syntax (_ [[name parameters] ..declaration extra (<>.some <code>.any)]) - (let [[_ short] name] - (in (list (` (.def: .public (~ (code.local short)) - (.List ..Definition) - (.list [..#definition (~ (code.text short)) - ..#documentation ((~! ..definition_documentation) - ((~ (code.symbol name)) - (~+ (list#each code.local parameters))) - (~+ extra))])))))))) + (macro.with_symbols [g!_] + (let [[_ short] name] + (in (list (` (.let [(~ g!_) (.is (.-> .Any (.List ..Definition)) + (.function ((~ g!_) (~ g!_)) + (.list [..#definition (~ (code.text short)) + ..#documentation ((~! ..definition_documentation) + ((~ (code.symbol name)) + (~+ (list#each code.local parameters))) + (~+ extra))])))] + ((~ g!_) []))))))))) (def: definitions_documentation (-> (List Definition) (Markdown Block)) @@ -704,7 +709,7 @@ (..listing un_expected))) ))) -(def: .public documentation +(def: .public markdown (-> (List Module) Text) (|>> (list.sorted (function (_ left right) (text#< (the #module right) (the #module left)))) diff --git a/stdlib/source/library/lux/ffi.lux b/stdlib/source/library/lux/ffi.lux index 49cb0115b..65fb0ea9c 100644 --- a/stdlib/source/library/lux/ffi.lux +++ b/stdlib/source/library/lux/ffi.lux @@ -53,7 +53,7 @@ @.python "python function" @.lua "lua function" (these))] - (primitive: .public (Object brand) Any) + (primitive .public (Object brand) Any) (with_expansions [<un_common> (for @.js (these [Symbol] [Null] @@ -66,7 +66,7 @@ <un_common> <un_common>] (with_template [<name>] [(with_expansions [<brand> (template.symbol [<name> "'"])] - (primitive: <brand> + (primitive <brand> Any (type: .public <name> diff --git a/stdlib/source/library/lux/ffi.php.lux b/stdlib/source/library/lux/ffi.php.lux index fb56839d3..f354972a3 100644 --- a/stdlib/source/library/lux/ffi.php.lux +++ b/stdlib/source/library/lux/ffi.php.lux @@ -23,11 +23,11 @@ ["[0]" code] ["[0]" template]]]]) -(abstract: .public (Object brand) Any) +(primitive .public (Object brand) Any) (with_template [<name>] [(with_expansions [<brand> (template.symbol [<name> "'"])] - (abstract: .public <brand> Any) + (primitive .public <brand> Any) (type: .public <name> (..Object <brand>)))] diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux index 257245540..79b59264d 100644 --- a/stdlib/source/library/lux/ffi.scm.lux +++ b/stdlib/source/library/lux/ffi.scm.lux @@ -23,11 +23,11 @@ ["[0]" code] ["[0]" template]]]]) -(abstract: .public (Object brand) Any) +(primitive .public (Object brand) Any) (with_template [<name>] [(with_expansions [<brand> (template.symbol [<name> "'"])] - (abstract: .public <brand> Any) + (primitive .public <brand> Any) (type: .public <name> (..Object <brand>)))] diff --git a/stdlib/source/library/lux/locale.lux b/stdlib/source/library/lux/locale.lux index 6b7d59c93..9587c8a8f 100644 --- a/stdlib/source/library/lux/locale.lux +++ b/stdlib/source/library/lux/locale.lux @@ -16,7 +16,7 @@ ["[0]" language (.only Language)] ["[0]" territory (.only Territory)]]) -(primitive: .public Locale +(primitive .public Locale Text (def: territory_separator "_") diff --git a/stdlib/source/library/lux/locale/language.lux b/stdlib/source/library/lux/locale/language.lux index e17fe5ff3..21930e92f 100644 --- a/stdlib/source/library/lux/locale/language.lux +++ b/stdlib/source/library/lux/locale/language.lux @@ -12,7 +12,7 @@ ["[0]" template]]]]) ... https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes -(primitive: .public Language +(primitive .public Language (Record [#name Text #code Text]) diff --git a/stdlib/source/library/lux/locale/territory.lux b/stdlib/source/library/lux/locale/territory.lux index 26d65e515..b31531412 100644 --- a/stdlib/source/library/lux/locale/territory.lux +++ b/stdlib/source/library/lux/locale/territory.lux @@ -12,7 +12,7 @@ ["[0]" template]]]]) ... https://en.wikipedia.org/wiki/ISO_3166-1 -(primitive: .public Territory +(primitive .public Territory (Record [#name Text #short Text diff --git a/stdlib/source/library/lux/math/modular.lux b/stdlib/source/library/lux/math/modular.lux index d1e4860cd..c12f2111d 100644 --- a/stdlib/source/library/lux/math/modular.lux +++ b/stdlib/source/library/lux/math/modular.lux @@ -26,7 +26,7 @@ ["[0]" // ["[1]" modulus (.only Modulus)]]) -(primitive: .public (Mod m) +(primitive .public (Mod m) (Record [#modulus (Modulus m) #value Int]) diff --git a/stdlib/source/library/lux/math/modulus.lux b/stdlib/source/library/lux/math/modulus.lux index 43d341214..7071c834a 100644 --- a/stdlib/source/library/lux/math/modulus.lux +++ b/stdlib/source/library/lux/math/modulus.lux @@ -20,7 +20,7 @@ (exception: .public zero_cannot_be_a_modulus) -(primitive: .public (Modulus %) +(primitive .public (Modulus %) Int (def: .public (modulus value) diff --git a/stdlib/source/library/lux/target/common_lisp.lux b/stdlib/source/library/lux/target/common_lisp.lux index d058f5737..a95e1df67 100644 --- a/stdlib/source/library/lux/target/common_lisp.lux +++ b/stdlib/source/library/lux/target/common_lisp.lux @@ -20,7 +20,7 @@ (-> Text Text) (text.enclosed ["(" ")"])) -(primitive: .public (Code brand) +(primitive .public (Code brand) Text (def: .public manual @@ -33,7 +33,7 @@ (with_template [<type> <super>] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (`` (primitive: .public (<brand> brand) Any)) + (`` (primitive .public (<brand> brand) Any)) (`` (type: .public (<type> brand) (<super> (<brand> brand)))))] @@ -47,7 +47,7 @@ (with_template [<type> <super>] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (`` (primitive: .public <brand> Any)) + (`` (primitive .public <brand> Any)) (`` (type: .public <type> (<super> <brand>))))] [Label Code] diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux index ddb2359a9..ae5ffe9d1 100644 --- a/stdlib/source/library/lux/target/js.lux +++ b/stdlib/source/library/lux/target/js.lux @@ -33,7 +33,7 @@ (|>> (format \n+) (text.replaced text.new_line (format text.new_line text.tab)))) -(primitive: .public (Code brand) +(primitive .public (Code brand) Text (def: .public code @@ -42,7 +42,7 @@ (with_template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (primitive: (<brand> brand) Any) + (primitive (<brand> brand) Any) (`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+))))))] [Expression [Code]] @@ -53,7 +53,7 @@ (with_template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (primitive: <brand> Any) + (primitive <brand> Any) (`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+))))))] [Var [Location' Computation' Expression' Code]] diff --git a/stdlib/source/library/lux/target/jvm/bytecode/address.lux b/stdlib/source/library/lux/target/jvm/bytecode/address.lux index 85952b623..ddb1331dc 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/address.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/address.lux @@ -23,7 +23,7 @@ ["[1][0]" unsigned (.only U2)] ["[1][0]" signed (.only S4)]]]]) -(primitive: .public Address +(primitive .public Address U2 (def: .public value diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux index 21643a9c1..6e3642501 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux @@ -28,7 +28,7 @@ (def: normal 1) (def: wide 2) -(primitive: .public Registry +(primitive .public Registry U2 (def: .public registry diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux index 891a6bc4f..a3cec4224 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux @@ -17,7 +17,7 @@ [encoding ["[1][0]" unsigned (.only U2)]]]) -(primitive: .public Stack +(primitive .public Stack U2 (with_template [<frames> <name>] diff --git a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux index 498140007..9345f2ec2 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux @@ -221,7 +221,7 @@ [(n.+ (///unsigned.value ..size/211) size) (|>> mutation ((trinary/211' opcode input0 input1 input2)))])]) -(primitive: .public Primitive_Array_Type +(primitive .public Primitive_Array_Type U1 (def: code diff --git a/stdlib/source/library/lux/target/jvm/constant.lux b/stdlib/source/library/lux/target/jvm/constant.lux index d02197a09..8539fbf13 100644 --- a/stdlib/source/library/lux/target/jvm/constant.lux +++ b/stdlib/source/library/lux/target/jvm/constant.lux @@ -40,7 +40,7 @@ (Writer UTF8) binaryF.utf8_16) -(primitive: .public Class +(primitive .public Class (Index UTF8) (def: .public index @@ -82,7 +82,7 @@ "[1]::[0]" ("static" doubleToRawLongBits [double] long)) -(primitive: .public (Value kind) +(primitive .public (Value kind) kind (def: .public value diff --git a/stdlib/source/library/lux/target/jvm/constant/tag.lux b/stdlib/source/library/lux/target/jvm/constant/tag.lux index 88ec6eff2..2ac10790f 100644 --- a/stdlib/source/library/lux/target/jvm/constant/tag.lux +++ b/stdlib/source/library/lux/target/jvm/constant/tag.lux @@ -14,7 +14,7 @@ [encoding ["[1][0]" unsigned (.only U1) (.open: "u1//[0]" equivalence)]]]) -(primitive: .public Tag +(primitive .public Tag U1 (def: .public equivalence diff --git a/stdlib/source/library/lux/target/jvm/encoding/name.lux b/stdlib/source/library/lux/target/jvm/encoding/name.lux index 2dd465d20..2a322bace 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/name.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/name.lux @@ -13,7 +13,7 @@ (type: .public External Text) -(primitive: .public Internal +(primitive .public Internal Text (def: .public internal diff --git a/stdlib/source/library/lux/target/jvm/encoding/signed.lux b/stdlib/source/library/lux/target/jvm/encoding/signed.lux index c402c2300..822e420b2 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/signed.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/signed.lux @@ -22,7 +22,7 @@ [type [primitive (.except)]]]]) -(primitive: .public (Signed brand) +(primitive .public (Signed brand) Int (def: .public value @@ -50,7 +50,7 @@ (with_template [<bytes> <name> <size> <constructor> <maximum> <minimum> <+> <->] [(with_expansions [<raw> (template.symbol [<name> "'"])] - (primitive: <raw> Any) + (primitive <raw> Any) (type: .public <name> (Signed <raw>))) (def: .public <size> <bytes>) diff --git a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux index 1c4d260dc..bdda3b8a5 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux @@ -21,7 +21,7 @@ [type [primitive (.except)]]]]) -(primitive: .public (Unsigned brand) +(primitive .public (Unsigned brand) Nat (def: .public value @@ -62,7 +62,7 @@ (with_template [<bytes> <name> <size> <constructor> <maximum> <+> <-> <max>] [(with_expansions [<raw> (template.symbol [<name> "'"])] - (primitive: .public <raw> Any) + (primitive .public <raw> Any) (type: .public <name> (Unsigned <raw>))) (def: .public <size> <bytes>) diff --git a/stdlib/source/library/lux/target/jvm/index.lux b/stdlib/source/library/lux/target/jvm/index.lux index 5fa1e0bb9..e3421fd14 100644 --- a/stdlib/source/library/lux/target/jvm/index.lux +++ b/stdlib/source/library/lux/target/jvm/index.lux @@ -15,7 +15,7 @@ (def: .public length //unsigned.bytes/2) -(primitive: .public (Index kind) +(primitive .public (Index kind) U2 (def: .public index diff --git a/stdlib/source/library/lux/target/jvm/modifier.lux b/stdlib/source/library/lux/target/jvm/modifier.lux index b76886f54..04db97f3f 100644 --- a/stdlib/source/library/lux/target/jvm/modifier.lux +++ b/stdlib/source/library/lux/target/jvm/modifier.lux @@ -23,7 +23,7 @@ [encoding ["[1][0]" unsigned]]]) -(primitive: .public (Modifier of) +(primitive .public (Modifier of) //unsigned.U2 (def: .public code diff --git a/stdlib/source/library/lux/target/jvm/modifier/inner.lux b/stdlib/source/library/lux/target/jvm/modifier/inner.lux index ee47de449..693946b75 100644 --- a/stdlib/source/library/lux/target/jvm/modifier/inner.lux +++ b/stdlib/source/library/lux/target/jvm/modifier/inner.lux @@ -2,10 +2,10 @@ [library [lux (.except static) [type - abstract]]] + [primitive (.except)]]]] [// (.only modifiers)]) -(abstract: .public Inner Any) +(primitive .public Inner Any) (modifiers Inner diff --git a/stdlib/source/library/lux/target/jvm/type.lux b/stdlib/source/library/lux/target/jvm/type.lux index 1f7362ee6..18c21263c 100644 --- a/stdlib/source/library/lux/target/jvm/type.lux +++ b/stdlib/source/library/lux/target/jvm/type.lux @@ -25,7 +25,7 @@ ["[1][0]" descriptor (.only Descriptor)] ["[1][0]" reflection (.only Reflection)]]) -(primitive: .public (Type category) +(primitive .public (Type category) [(Signature category) (Descriptor category) (Reflection category)] diff --git a/stdlib/source/library/lux/target/jvm/type/category.lux b/stdlib/source/library/lux/target/jvm/type/category.lux index 03e389d2a..c9115e3b4 100644 --- a/stdlib/source/library/lux/target/jvm/type/category.lux +++ b/stdlib/source/library/lux/target/jvm/type/category.lux @@ -6,24 +6,24 @@ [type [primitive (.except)]]]]) -(primitive: Void' Any) -(primitive: .public (Value' kind) Any) -(primitive: .public (Return' kind) Any) -(primitive: .public Method Any) +(primitive Void' Any) +(primitive .public (Value' kind) Any) +(primitive .public (Return' kind) Any) +(primitive .public Method Any) (type: .public Return (<| Return' Any)) (type: .public Value (<| Return' Value' Any)) (type: .public Void (<| Return' Void')) -(primitive: (Object' brand) Any) +(primitive (Object' brand) Any) (type: .public Object (<| Return' Value' Object' Any)) -(primitive: (Parameter' brand) Any) +(primitive (Parameter' brand) Any) (type: .public Parameter (<| Return' Value' Object' Parameter' Any)) (with_template [<parents> <child>] [(with_expansions [<raw> (template.symbol [<child> "'"])] - (primitive: <raw> Any) + (primitive <raw> Any) (type: .public <child> (`` (<| Return' Value' (~~ (template.spliced <parents>)) <raw>))))] @@ -33,5 +33,5 @@ [[Object' Parameter'] Array] ) -(primitive: .public Declaration Any) -(primitive: .public Inheritance Any) +(primitive .public Declaration Any) +(primitive .public Inheritance Any) diff --git a/stdlib/source/library/lux/target/jvm/type/descriptor.lux b/stdlib/source/library/lux/target/jvm/type/descriptor.lux index b5948d6f4..99b3987d5 100644 --- a/stdlib/source/library/lux/target/jvm/type/descriptor.lux +++ b/stdlib/source/library/lux/target/jvm/type/descriptor.lux @@ -21,7 +21,7 @@ [encoding ["[1][0]" name (.only Internal External)]]]]) -(primitive: .public (Descriptor category) +(primitive .public (Descriptor category) Text (def: .public descriptor diff --git a/stdlib/source/library/lux/target/jvm/type/lux.lux b/stdlib/source/library/lux/target/jvm/type/lux.lux index a9917f398..ea7951cee 100644 --- a/stdlib/source/library/lux/target/jvm/type/lux.lux +++ b/stdlib/source/library/lux/target/jvm/type/lux.lux @@ -30,7 +30,7 @@ ["[1][0]" name]]]]) (with_template [<name>] - [(primitive: .public (<name> class) Any)] + [(primitive .public (<name> class) Any)] [Lower] [Upper] ) diff --git a/stdlib/source/library/lux/target/jvm/type/reflection.lux b/stdlib/source/library/lux/target/jvm/type/reflection.lux index 33beded66..7794fedc3 100644 --- a/stdlib/source/library/lux/target/jvm/type/reflection.lux +++ b/stdlib/source/library/lux/target/jvm/type/reflection.lux @@ -15,7 +15,7 @@ [encoding ["[1][0]" name (.only External)]]]]) -(primitive: .public (Reflection category) +(primitive .public (Reflection category) Text (def: .public reflection diff --git a/stdlib/source/library/lux/target/jvm/type/signature.lux b/stdlib/source/library/lux/target/jvm/type/signature.lux index 04be4f980..610706176 100644 --- a/stdlib/source/library/lux/target/jvm/type/signature.lux +++ b/stdlib/source/library/lux/target/jvm/type/signature.lux @@ -20,7 +20,7 @@ [encoding ["[1][0]" name (.only External)]]]]) -(primitive: .public (Signature category) +(primitive .public (Signature category) Text (def: .public signature diff --git a/stdlib/source/library/lux/target/lua.lux b/stdlib/source/library/lux/target/lua.lux index ded81917a..67986980d 100644 --- a/stdlib/source/library/lux/target/lua.lux +++ b/stdlib/source/library/lux/target/lua.lux @@ -40,7 +40,7 @@ (def: input_separator ", ") -(primitive: .public (Code brand) +(primitive .public (Code brand) Text (def: .public equivalence @@ -65,7 +65,7 @@ (with_template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (primitive: (<brand> brand) Any) + (primitive (<brand> brand) Any) (`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+))))))] [Expression [Code]] @@ -76,7 +76,7 @@ (with_template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (primitive: <brand> Any) + (primitive <brand> Any) (`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+))))))] [Literal [Computation' Expression' Code]] diff --git a/stdlib/source/library/lux/target/php.lux b/stdlib/source/library/lux/target/php.lux index ddfdd0478..892b98a25 100644 --- a/stdlib/source/library/lux/target/php.lux +++ b/stdlib/source/library/lux/target/php.lux @@ -48,7 +48,7 @@ (-> Text Text) (text.enclosed ["(" ")"])) -(primitive: .public (Code brand) +(primitive .public (Code brand) Text (def: .public equivalence @@ -73,7 +73,7 @@ (with_template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (primitive: (<brand> brand) Any) + (primitive (<brand> brand) Any) (`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+))))))] [Expression [Code]] @@ -84,7 +84,7 @@ (with_template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (primitive: .public <brand> Any) + (primitive .public <brand> Any) (`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+))))))] [Literal [Computation' Expression' Code]] diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux index 8d245f684..4e85ea258 100644 --- a/stdlib/source/library/lux/target/python.lux +++ b/stdlib/source/library/lux/target/python.lux @@ -57,7 +57,7 @@ (|>> (format \n+) (text.replaced text.new_line nested_new_line))))) -(primitive: .public (Code brand) +(primitive .public (Code brand) Text (def: .public equivalence @@ -82,7 +82,7 @@ (with_template [<type> <super>] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (`` (primitive: (<brand> brand) Any)) + (`` (primitive (<brand> brand) Any)) (`` (type: .public (<type> brand) (<super> (<brand> brand)))))] @@ -95,7 +95,7 @@ (with_template [<type> <super>] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (`` (primitive: <brand> Any)) + (`` (primitive <brand> Any)) (`` (type: .public <type> (<super> <brand>))))] [Literal Computation] @@ -104,7 +104,7 @@ ) (with_template [<var> <brand>] - [(primitive: .public <brand> Any) + [(primitive .public <brand> Any) (type: .public <var> (Var <brand>))] diff --git a/stdlib/source/library/lux/target/r.lux b/stdlib/source/library/lux/target/r.lux index a5658a87c..4956df9c0 100644 --- a/stdlib/source/library/lux/target/r.lux +++ b/stdlib/source/library/lux/target/r.lux @@ -22,12 +22,12 @@ [type [primitive (.except)]]]]) -(primitive: .public (Code kind) +(primitive .public (Code kind) Text (with_template [<type> <super>+] [(with_expansions [<kind> (template.symbol [<type> "'"])] - (primitive: .public (<kind> kind) Any) + (primitive .public (<kind> kind) Any) (`` (type: .public <type> (|> Any <kind> (~~ (template.spliced <super>+))))))] [Expression [Code]] @@ -35,14 +35,14 @@ (with_template [<type> <super>+] [(with_expansions [<kind> (template.symbol [<type> "'"])] - (primitive: .public (<kind> kind) Any) + (primitive .public (<kind> kind) Any) (`` (type: .public (<type> <brand>) (|> <brand> <kind> (~~ (template.spliced <super>+))))))] [Var [Expression' Code]] ) (with_template [<var> <kind>] - [(primitive: .public <kind> Any) + [(primitive .public <kind> Any) (type: .public <var> (Var <kind>))] [SVar Single] diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux index 44e0018f9..ae928f407 100644 --- a/stdlib/source/library/lux/target/ruby.lux +++ b/stdlib/source/library/lux/target/ruby.lux @@ -40,7 +40,7 @@ (|>> (format \n+) (text.replaced text.new_line nested_new_line)))) -(primitive: .public (Code brand) +(primitive .public (Code brand) Text (def: .public equivalence @@ -59,7 +59,7 @@ (with_template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (primitive: (<brand> brand) Any) + (primitive (<brand> brand) Any) (`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+))))))] [Expression [Code]] @@ -72,7 +72,7 @@ (with_template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (primitive: <brand> Any) + (primitive <brand> Any) (`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+))))))] [Literal [Computation' Expression' Code]] diff --git a/stdlib/source/library/lux/target/scheme.lux b/stdlib/source/library/lux/target/scheme.lux index ff7647574..c0632b5be 100644 --- a/stdlib/source/library/lux/target/scheme.lux +++ b/stdlib/source/library/lux/target/scheme.lux @@ -31,7 +31,7 @@ (.let [nested_new_line (format text.new_line text.tab)] (text.replaced text.new_line nested_new_line))) -(primitive: .public (Code k) +(primitive .public (Code k) Text (def: .public equivalence @@ -47,14 +47,14 @@ (def: hash (|>> representation (at text.hash hash))))) (with_template [<type> <brand> <super>+] - [(primitive: .public (<brand> brand) Any) + [(primitive .public (<brand> brand) Any) (`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+)))))] [Expression Expression' [Code]] ) (with_template [<type> <brand> <super>+] - [(primitive: .public <brand> Any) + [(primitive .public <brand> Any) (`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+)))))] [Var Var' [Expression' Code]] diff --git a/stdlib/source/library/lux/time.lux b/stdlib/source/library/lux/time.lux index 2416d3867..b977ceba1 100644 --- a/stdlib/source/library/lux/time.lux +++ b/stdlib/source/library/lux/time.lux @@ -76,7 +76,7 @@ [..seconds second_parser invalid_second ..section_parser] ) -(primitive: .public Time +(primitive .public Time Nat (def: .public midnight diff --git a/stdlib/source/library/lux/time/date.lux b/stdlib/source/library/lux/time/date.lux index 96f855fee..f01124fac 100644 --- a/stdlib/source/library/lux/time/date.lux +++ b/stdlib/source/library/lux/time/date.lux @@ -69,7 +69,7 @@ (def: separator "-") -(primitive: .public Date +(primitive .public Date (Record [#year Year #month Month diff --git a/stdlib/source/library/lux/time/duration.lux b/stdlib/source/library/lux/time/duration.lux index e608a8075..1b37584bf 100644 --- a/stdlib/source/library/lux/time/duration.lux +++ b/stdlib/source/library/lux/time/duration.lux @@ -23,7 +23,7 @@ ["[0]" // ["[1][0]" year]]) -(primitive: .public Duration +(primitive .public Duration Int (def: .public of_millis diff --git a/stdlib/source/library/lux/time/instant.lux b/stdlib/source/library/lux/time/instant.lux index 5298fdb17..daa4b8c2e 100644 --- a/stdlib/source/library/lux/time/instant.lux +++ b/stdlib/source/library/lux/time/instant.lux @@ -30,7 +30,7 @@ ["[0]" day (.only Day)] ["[0]" date (.only Date)]]) -(primitive: .public Instant +(primitive .public Instant Int (def: .public of_millis diff --git a/stdlib/source/library/lux/time/year.lux b/stdlib/source/library/lux/time/year.lux index 78093d222..244c8417f 100644 --- a/stdlib/source/library/lux/time/year.lux +++ b/stdlib/source/library/lux/time/year.lux @@ -35,7 +35,7 @@ (exception: .public there_is_no_year_0) ... https://en.wikipedia.org/wiki/Gregorian_calendar -(primitive: .public Year +(primitive .public Year Int (def: .public (year value) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux index 92c263466..bdb87cb95 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux @@ -71,7 +71,7 @@ #output Output #registry Registry])) -(primitive: .public Archive +(primitive .public Archive (Record [#next module.ID #resolver (Dictionary descriptor.Module [module.ID (Maybe (Entry Any))])]) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux index 62438a178..445e44c72 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux @@ -6,7 +6,7 @@ [// [signature (.only Signature)]]) -(primitive: .public (Key k) +(primitive .public (Key k) Signature (def: .public signature diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux index ef3073cca..753950787 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux @@ -25,7 +25,7 @@ "Expected" (signature.description expected) "Actual" (signature.description actual))) -(primitive: .public (Document d) +(primitive .public (Document d) (Record [#signature Signature #content d]) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux index 0f15e8ca7..09cfc1190 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux @@ -29,7 +29,7 @@ ["[1]" artifact (.only Artifact ID) ["[2][0]" category (.only Category)]]]) -(primitive: .public Registry +(primitive .public Registry (Record [#artifacts (Sequence [Artifact (Set unit.ID)]) #resolver (Dictionary Text [ID (Maybe //category.Definition)])]) diff --git a/stdlib/source/library/lux/type/dynamic.lux b/stdlib/source/library/lux/type/dynamic.lux index 0c10c31bf..3797e528c 100644 --- a/stdlib/source/library/lux/type/dynamic.lux +++ b/stdlib/source/library/lux/type/dynamic.lux @@ -13,7 +13,7 @@ [macro (.only with_symbols) ["[0]" syntax (.only syntax)]] ["[0]" type (.only) - ["[0]" primitive (.only primitive:)]]]]) + ["[0]" primitive (.only primitive)]]]]) (exception: .public (wrong_type [expected Type actual Type]) @@ -21,7 +21,7 @@ "Expected" (%.type expected) "Actual" (%.type actual))) -(primitive: .public Dynamic +(primitive .public Dynamic [Type Any] (def: abstraction diff --git a/stdlib/source/library/lux/type/primitive.lux b/stdlib/source/library/lux/type/primitive.lux index b6dd7ff81..53202405e 100644 --- a/stdlib/source/library/lux/type/primitive.lux +++ b/stdlib/source/library/lux/type/primitive.lux @@ -225,7 +225,7 @@ ... TODO: Make sure the generated code always gets optimized away. ... (This applies to uses of "abstraction" and "representation") -(def: .public primitive: +(def: .public primitive (syntax (_ [[export_policy [name type_vars] representation_type primitives] ..abstract]) (do meta.monad diff --git a/stdlib/source/library/lux/type/quotient.lux b/stdlib/source/library/lux/type/quotient.lux index 9ae7ac08e..59f518ad8 100644 --- a/stdlib/source/library/lux/type/quotient.lux +++ b/stdlib/source/library/lux/type/quotient.lux @@ -11,7 +11,7 @@ ["[0]" type [primitive (.except)]]]]) -(primitive: .public (Class t c %) +(primitive .public (Class t c %) (-> t c) (def: .public class @@ -20,7 +20,7 @@ (-> (-> t c) (Class t c %)))) (|>> abstraction)) - (primitive: .public (Quotient t c %) + (primitive .public (Quotient t c %) (Record [#value t #label c]) diff --git a/stdlib/source/library/lux/type/refinement.lux b/stdlib/source/library/lux/type/refinement.lux index 6eefbe2fb..102ba9c5a 100644 --- a/stdlib/source/library/lux/type/refinement.lux +++ b/stdlib/source/library/lux/type/refinement.lux @@ -11,7 +11,7 @@ ["[0]" type (.only) [primitive (.except)]]]]) -(primitive: .public (Refined t %) +(primitive .public (Refined t %) (Record [#value t #predicate (Predicate t)]) diff --git a/stdlib/source/library/lux/type/resource.lux b/stdlib/source/library/lux/type/resource.lux index c9f7b13d7..0827dde1e 100644 --- a/stdlib/source/library/lux/type/resource.lux +++ b/stdlib/source/library/lux/type/resource.lux @@ -66,10 +66,10 @@ [output procedure] (in [keys output])))) -(primitive: .public Ordered Any) -(primitive: .public Commutative Any) +(primitive .public Ordered Any) +(primitive .public Commutative Any) -(primitive: .public (Key mode key) +(primitive .public (Key mode key) Any (with_template [<name> <mode>] @@ -81,7 +81,7 @@ [commutative_key Commutative] )) -(primitive: .public (Res key value) +(primitive .public (Res key value) value (with_template [<name> <mode> <key>] diff --git a/stdlib/source/library/lux/type/unit.lux b/stdlib/source/library/lux/type/unit.lux index 1d2cc20ca..631cc79a5 100644 --- a/stdlib/source/library/lux/type/unit.lux +++ b/stdlib/source/library/lux/type/unit.lux @@ -16,7 +16,7 @@ ["[0]" // (.only) [primitive (.except)]]) -(primitive: .public (Qty scale unit) +(primitive .public (Qty scale unit) Int (def: .public quantity diff --git a/stdlib/source/library/lux/world/db/sql.lux b/stdlib/source/library/lux/world/db/sql.lux index db9042b05..5c9fedc94 100644 --- a/stdlib/source/library/lux/world/db/sql.lux +++ b/stdlib/source/library/lux/world/db/sql.lux @@ -21,7 +21,7 @@ ... Kind (with_template [<declaration>] - [(primitive: .public <declaration> Any)] + [(primitive .public <declaration> Any)] [Literal'] [Column'] @@ -62,7 +62,7 @@ (def: .public no_alias Alias "") -(primitive: .public (SQL kind) +(primitive .public (SQL kind) Text ... SQL diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux index 84f9cae1d..dc890fa54 100644 --- a/stdlib/source/library/lux/world/file/watch.lux +++ b/stdlib/source/library/lux/world/file/watch.lux @@ -29,10 +29,10 @@ [time ["[0]" instant (.only Instant) (.open: "[1]#[0]" equivalence)]] [type - [primitive (.only primitive: representation abstraction)]]]] + [primitive (.only primitive representation abstraction)]]]] ["[0]" //]) -(primitive: .public Concern +(primitive .public Concern (Record [#creation Bit #modification Bit diff --git a/stdlib/source/library/lux/world/net/http/mime.lux b/stdlib/source/library/lux/world/net/http/mime.lux index a1479c4c3..36a5bae3d 100644 --- a/stdlib/source/library/lux/world/net/http/mime.lux +++ b/stdlib/source/library/lux/world/net/http/mime.lux @@ -8,7 +8,7 @@ [type [primitive (.except)]]]]) -(primitive: .public MIME +(primitive .public MIME Text (def: .public mime diff --git a/stdlib/source/library/lux/world/program.lux b/stdlib/source/library/lux/world/program.lux index 7fcf31922..b0df93d8b 100644 --- a/stdlib/source/library/lux/world/program.lux +++ b/stdlib/source/library/lux/world/program.lux @@ -273,8 +273,8 @@ ... @.scheme ... (these (ffi.import (exit [Int] "io" Nothing)) ... ... https://srfi.schemers.org/srfi-98/srfi-98.html - ... (abstract: Pair Any) - ... (abstract: PList Any) + ... (primitive Pair Any) + ... (primitive PList Any) ... (ffi.import (get-environment-variables [] "io" PList)) ... (ffi.import (car [Pair] Text)) ... (ffi.import (cdr [Pair] Text)) diff --git a/stdlib/source/program/aedifex/artifact/time/date.lux b/stdlib/source/program/aedifex/artifact/time/date.lux index 7c9096985..027ec6004 100644 --- a/stdlib/source/program/aedifex/artifact/time/date.lux +++ b/stdlib/source/program/aedifex/artifact/time/date.lux @@ -38,7 +38,7 @@ "Maximum" (%.int ..max_year) "Year" (%.int (year.value year)))) -(primitive: .public Date +(primitive .public Date date.Date (def: .public epoch diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux index 32be3a8ee..7a2668bc7 100644 --- a/stdlib/source/program/aedifex/hash.lux +++ b/stdlib/source/program/aedifex/hash.lux @@ -34,10 +34,10 @@ ("static" getInstance [java/lang/String] java/security/MessageDigest) (digest [[byte]] [byte])) -(primitive: .public SHA-1 Any) -(primitive: .public MD5 Any) +(primitive .public SHA-1 Any) +(primitive .public MD5 Any) -(primitive: .public (Hash h) +(primitive .public (Hash h) Binary (def: .public data diff --git a/stdlib/source/test/lux/type/primitive.lux b/stdlib/source/test/lux/type/primitive.lux index dd544ceb8..c2be544ed 100644 --- a/stdlib/source/test/lux/type/primitive.lux +++ b/stdlib/source/test/lux/type/primitive.lux @@ -48,16 +48,16 @@ (with_expansions [no_current! (..with_no_active_frames (..current)) no_specific! (..with_no_active_frames (..specific))] - (/.primitive: (g!Foo a) + (/.primitive (g!Foo a) Text - (/.primitive: (g!Bar a) + (/.primitive (g!Bar a) Nat (def: .public test Test (<| (_.covering /._) - (_.for [/.primitive:]) + (_.for [/.primitive]) (do random.monad [expected_foo (random.lower_case 5) expected_bar random.nat] |