aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stdlib/source/lux/cli.lux4
-rw-r--r--stdlib/source/lux/concurrency/actor.lux17
-rw-r--r--stdlib/source/lux/concurrency/task.lux2
-rw-r--r--stdlib/source/lux/control/concatenative.lux18
-rw-r--r--stdlib/source/lux/control/exception.lux10
-rw-r--r--stdlib/source/lux/control/monad/indexed.lux2
-rw-r--r--stdlib/source/lux/control/pipe.lux27
-rw-r--r--stdlib/source/lux/data/coll/sequence.lux2
-rw-r--r--stdlib/source/lux/data/coll/stream.lux4
-rw-r--r--stdlib/source/lux/data/coll/tree/rose.lux2
-rw-r--r--stdlib/source/lux/data/number/complex.lux2
-rw-r--r--stdlib/source/lux/data/number/ratio.lux2
-rw-r--r--stdlib/source/lux/data/text/format.lux2
-rw-r--r--stdlib/source/lux/data/text/regex.lux6
-rw-r--r--stdlib/source/lux/host.js.lux9
-rw-r--r--stdlib/source/lux/host.jvm.lux102
-rw-r--r--stdlib/source/lux/macro/poly.lux14
-rw-r--r--stdlib/source/lux/macro/syntax.lux14
-rw-r--r--stdlib/source/lux/math.lux2
-rw-r--r--stdlib/source/lux/math/constructive.lux27
-rw-r--r--stdlib/source/lux/math/modular.lux2
-rw-r--r--stdlib/source/lux/type/abstract.lux17
-rw-r--r--stdlib/source/lux/type/implicit.lux7
-rw-r--r--stdlib/source/lux/type/object/interface.lux26
-rw-r--r--stdlib/source/lux/type/object/protocol.lux7
-rw-r--r--stdlib/source/lux/type/quotient.lux2
-rw-r--r--stdlib/source/lux/type/refinement.lux2
-rw-r--r--stdlib/source/lux/type/resource.lux4
-rw-r--r--stdlib/source/lux/type/unit.lux16
29 files changed, 194 insertions, 157 deletions
diff --git a/stdlib/source/lux/cli.lux b/stdlib/source/lux/cli.lux
index 51c020812..7a88b84f8 100644
--- a/stdlib/source/lux/cli.lux
+++ b/stdlib/source/lux/cli.lux
@@ -102,7 +102,9 @@
(wrap [(code.symbol ["" name]) (` any)]))
(s.tuple (p.seq s.any s.any)))))))
-(syntax: #export (program: [args program-args^] body)
+(syntax: #export (program:
+ {args program-args^}
+ body)
{#.doc (doc "Defines the entry-point to a program (similar to the \"main\" function/method in other programming languages)."
"Can take a list of all the input parameters to the program, or can destructure them using CLI-option combinators from the lux/cli module."
(program: all-args
diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux
index a50b7a046..0e85758ed 100644
--- a/stdlib/source/lux/concurrency/actor.lux
+++ b/stdlib/source/lux/concurrency/actor.lux
@@ -195,11 +195,12 @@
(p.maybe (s.form (p.seq (s.form (p.after (s.this (' stop)) stop-args))
s.any))))))
-(syntax: #export (actor: [export csr.export]
- [[_name _vars] actor-decl^]
- [annotations (p.default cs.empty-annotations csr.annotations)]
+(syntax: #export (actor:
+ {export csr.export}
+ {[_name _vars] actor-decl^}
+ {annotations (p.default cs.empty-annotations csr.annotations)}
state-type
- [[?handle ?stop] behavior^])
+ {[?handle ?stop] behavior^})
{#.doc (doc "Defines an actor, with its behavior and internal state."
(actor: #export Counter
Nat
@@ -289,9 +290,11 @@
(p.either (s.form (p.seq s.symbol (p.some s.local-symbol)))
(p.seq s.symbol (:: p.Monad<Parser> wrap (list)))))
-(syntax: #export (message: [export csr.export] [[actor-name actor-vars] reference^]
- [signature signature^]
- [annotations (p.default cs.empty-annotations csr.annotations)]
+(syntax: #export (message:
+ {export csr.export}
+ {[actor-name actor-vars] reference^}
+ {signature signature^}
+ {annotations (p.default cs.empty-annotations csr.annotations)}
body)
{#.doc (doc "A message can access the actor's state through the state parameter."
"A message can also access the actor itself through the self parameter."
diff --git a/stdlib/source/lux/concurrency/task.lux b/stdlib/source/lux/concurrency/task.lux
index 0f95d428c..66cc12ff3 100644
--- a/stdlib/source/lux/concurrency/task.lux
+++ b/stdlib/source/lux/concurrency/task.lux
@@ -69,7 +69,7 @@
(#E.Success ma)
ma))))
-(syntax: #export (task [type s.any])
+(syntax: #export (task {type s.any})
{#.doc (doc "Makes an uninitialized Task (in this example, of Unit)."
(task Unit))}
(wrap (list (` (: (..Task (~ type))
diff --git a/stdlib/source/lux/control/concatenative.lux b/stdlib/source/lux/control/concatenative.lux
index ceda943e4..ee342ec22 100644
--- a/stdlib/source/lux/control/concatenative.lux
+++ b/stdlib/source/lux/control/concatenative.lux
@@ -60,9 +60,9 @@
(macro.fail (format "Cannot expand to more than a single AST/Code node:\n"
(|> expansion (list/map %code) (text.join-with " ")))))))
-(syntax: #export (=> [aliases aliases^]
- [inputs stack^]
- [outputs stack^])
+(syntax: #export (=> {aliases aliases^}
+ {inputs stack^}
+ {outputs stack^})
(let [de-alias (function (_ aliased)
(list/fold (function (_ [from to] pre)
(code.replace (code.local-symbol from) to pre))
@@ -109,19 +109,21 @@
_
command))
-(syntax: #export (||> [commands (p.some s.any)])
+(syntax: #export (||> {commands (p.some s.any)})
(wrap (list (` (|> (~! ..begin!) (~+ (list/map prepare commands)) (~! ..end!))))))
-(syntax: #export (word: [export csr.export] [name s.local-symbol]
- [annotations (p.default cs.empty-annotations csr.annotations)]
+(syntax: #export (word:
+ {export csr.export}
+ {name s.local-symbol}
+ {annotations (p.default cs.empty-annotations csr.annotations)}
type
- [commands (p.some s.any)])
+ {commands (p.some s.any)})
(wrap (list (` (def: (~+ (csw.export export)) (~ (code.local-symbol name))
(~ (csw.annotations annotations))
(~ type)
(|>> (~+ (list/map prepare commands))))))))
-(syntax: #export (apply [arity (|> s.nat (p.filter (.n/> +0)))])
+(syntax: #export (apply {arity (|> s.nat (p.filter (.n/> +0)))})
(with-gensyms [g! g!func g!stack g!output]
(monad.do @
[g!inputs (|> (macro.gensym "input") (list.repeat arity) (monad.seq @))]
diff --git a/stdlib/source/lux/control/exception.lux b/stdlib/source/lux/control/exception.lux
index c3fc94277..b515f6c6b 100644
--- a/stdlib/source/lux/control/exception.lux
+++ b/stdlib/source/lux/control/exception.lux
@@ -70,11 +70,11 @@
(All [e] (-> (Exception e) e e.Error))
(#e.Error (construct exception message)))
-(syntax: #export (exception: [export csr.export]
- [t-vars (p.default (list) csr.type-variables)]
- [[name inputs] (p.either (p.seq s.local-symbol (wrap (list)))
- (s.form (p.seq s.local-symbol (p.some csr.typed-input))))]
- [body (p.maybe s.any)])
+(syntax: #export (exception: {export csr.export}
+ {t-vars (p.default (list) csr.type-variables)}
+ {[name inputs] (p.either (p.seq s.local-symbol (wrap (list)))
+ (s.form (p.seq s.local-symbol (p.some csr.typed-input))))}
+ {body (p.maybe s.any)})
{#.doc (doc "Define a new exception type."
"It moslty just serves as a way to tag error messages for later catching."
""
diff --git a/stdlib/source/lux/control/monad/indexed.lux b/stdlib/source/lux/control/monad/indexed.lux
index 1e03a4e7d..591c24813 100644
--- a/stdlib/source/lux/control/monad/indexed.lux
+++ b/stdlib/source/lux/control/monad/indexed.lux
@@ -38,7 +38,7 @@
(list binding value))
(syntax: #export (do monad
- [context (s.tuple (p.some context))]
+ {context (s.tuple (p.some context))}
expression)
(macro.with-gensyms [g!_ g!bind]
(wrap (list (` (let [(~' @) (~ monad)
diff --git a/stdlib/source/lux/control/pipe.lux b/stdlib/source/lux/control/pipe.lux
index 54b04dcdc..7e55fc447 100644
--- a/stdlib/source/lux/control/pipe.lux
+++ b/stdlib/source/lux/control/pipe.lux
@@ -14,7 +14,7 @@
(Syntax (List Code))
(s.tuple (p.some s.any)))
-(syntax: #export (new> [tokens (p.at-least +2 s.any)])
+(syntax: #export (new> {tokens (p.at-least +2 s.any)})
{#.doc (doc "Ignores the piped argument, and begins a new pipe."
(|> 20
(i/* 3)
@@ -39,11 +39,11 @@
(function (_ tokens)
(#e.Success [(list.reverse tokens) []])))
-(syntax: #export (cond> [_ _reverse_]
+(syntax: #export (cond> {_ _reverse_}
prev
- [else body^]
- [_ _reverse_]
- [branches (p.some (p.seq body^ body^))])
+ {else body^}
+ {_ _reverse_}
+ {branches (p.some (p.seq body^ body^))})
{#.doc (doc "Branching for pipes."
"Both the tests and the bodies are piped-code, and must be given inside a tuple."
(|> 5
@@ -59,7 +59,9 @@
(` (|> (~ g!temp) (~+ then))))))
(|> (~ g!temp) (~+ else)))))))))
-(syntax: #export (loop> [test body^] [then body^] prev)
+(syntax: #export (loop> {test body^}
+ {then body^}
+ prev)
{#.doc (doc "Loops for pipes."
"Both the testing and calculating steps are pipes and must be given inside tuples."
(|> 1
@@ -71,7 +73,9 @@
((~' recur) (|> (~ g!temp) (~+ then)))
(~ g!temp))))))))
-(syntax: #export (do> monad [steps (p.some body^)] prev)
+(syntax: #export (do> monad
+ {steps (p.some body^)}
+ prev)
{#.doc (doc "Monadic pipes."
"Each steps in the monadic computation is a pipe and must be given inside a tuple."
(|> 5
@@ -93,7 +97,8 @@
_
(wrap (list prev)))))
-(syntax: #export (exec> [body body^] prev)
+(syntax: #export (exec> {body body^}
+ prev)
{#.doc (doc "Non-updating pipes."
"Will generate piped computations, but their results will not be used in the larger scope."
(|> 5
@@ -104,7 +109,8 @@
(exec (|> (~ g!temp) (~+ body))
(~ g!temp))))))))
-(syntax: #export (tuple> [paths (p.many body^)] prev)
+(syntax: #export (tuple> {paths (p.many body^)}
+ prev)
{#.doc (doc "Parallel branching for pipes."
"Allows to run multiple pipelines for a value and gives you a tuple of the outputs."
(|> 5
@@ -117,7 +123,8 @@
[(~+ (list/map (function (_ body) (` (|> (~ g!temp) (~+ body))))
paths))]))))))
-(syntax: #export (case> [branches (p.many (p.seq s.any s.any))] prev)
+(syntax: #export (case> {branches (p.many (p.seq s.any s.any))}
+ prev)
{#.doc (doc "Pattern-matching for pipes."
"The bodies of each branch are NOT pipes; just regular values."
(|> 5
diff --git a/stdlib/source/lux/data/coll/sequence.lux b/stdlib/source/lux/data/coll/sequence.lux
index b51e5034f..45a22e73b 100644
--- a/stdlib/source/lux/data/coll/sequence.lux
+++ b/stdlib/source/lux/data/coll/sequence.lux
@@ -337,7 +337,7 @@
(|>> (get@ #size) (n/= +0)))
## [Syntax]
-(syntax: #export (sequence [elems (p.some s.any)])
+(syntax: #export (sequence {elems (p.some s.any)})
{#.doc (doc "Sequence literals."
(sequence 10 20 30 40))}
(wrap (list (` (from-list (list (~+ elems)))))))
diff --git a/stdlib/source/lux/data/coll/stream.lux b/stdlib/source/lux/data/coll/stream.lux
index b6964d95f..d04b808fb 100644
--- a/stdlib/source/lux/data/coll/stream.lux
+++ b/stdlib/source/lux/data/coll/stream.lux
@@ -130,7 +130,9 @@
(pending [wa (split tail)]))))
## [Pattern-matching]
-(syntax: #export (^stream& [patterns (s.form (p.many s.any))] body [branches (p.some s.any)])
+(syntax: #export (^stream& {patterns (s.form (p.many s.any))}
+ body
+ {branches (p.some s.any)})
{#.doc (doc "Allows destructuring of streams in pattern-matching expressions."
"Caveat emptor: Only use it for destructuring, and not for testing values within the streams."
(let [(^stream& x y z _tail) (some-stream-func 1 2 3)]
diff --git a/stdlib/source/lux/data/coll/tree/rose.lux b/stdlib/source/lux/data/coll/tree/rose.lux
index 48a91c4fc..6c137878f 100644
--- a/stdlib/source/lux/data/coll/tree/rose.lux
+++ b/stdlib/source/lux/data/coll/tree/rose.lux
@@ -44,7 +44,7 @@
(p.seq s.any)
s.tuple))
-(syntax: #export (tree [root tree^])
+(syntax: #export (tree {root tree^})
{#.doc (doc "Tree literals."
(tree Int [10 {20 {}
30 {}
diff --git a/stdlib/source/lux/data/number/complex.lux b/stdlib/source/lux/data/number/complex.lux
index 5fb1360b5..7d4fcbfbf 100644
--- a/stdlib/source/lux/data/number/complex.lux
+++ b/stdlib/source/lux/data/number/complex.lux
@@ -18,7 +18,7 @@
{#real Frac
#imaginary Frac})
-(syntax: #export (complex real [?imaginary (p.maybe s.any)])
+(syntax: #export (complex real {?imaginary (p.maybe s.any)})
{#.doc (doc "Complex literals."
(complex real imaginary)
"The imaginary part can be omitted if it's 0."
diff --git a/stdlib/source/lux/data/number/ratio.lux b/stdlib/source/lux/data/number/ratio.lux
index a56a51433..2fe759932 100644
--- a/stdlib/source/lux/data/number/ratio.lux
+++ b/stdlib/source/lux/data/number/ratio.lux
@@ -150,7 +150,7 @@
#.None
(#.Left (text/compose "Invalid syntax for ratio: " input)))))
-(syntax: #export (ratio numerator [?denominator (p.maybe s.any)])
+(syntax: #export (ratio numerator {?denominator (p.maybe s.any)})
{#.doc (doc "Rational literals."
(ratio numerator denominator)
"The denominator can be omitted if it's 1."
diff --git a/stdlib/source/lux/data/text/format.lux b/stdlib/source/lux/data/text/format.lux
index 81c2e2fac..8ae82ef89 100644
--- a/stdlib/source/lux/data/text/format.lux
+++ b/stdlib/source/lux/data/text/format.lux
@@ -20,7 +20,7 @@
))
## [Syntax]
-(syntax: #export (format [fragments (p.many s.any)])
+(syntax: #export (format {fragments (p.many s.any)})
{#.doc (doc "Text interpolation."
(format "Static part " (%t static) " does not match URI: " uri))}
(macro.with-gensyms [g!compose]
diff --git a/stdlib/source/lux/data/text/regex.lux b/stdlib/source/lux/data/text/regex.lux
index 91f603af7..102f9632f 100644
--- a/stdlib/source/lux/data/text/regex.lux
+++ b/stdlib/source/lux/data/text/regex.lux
@@ -397,7 +397,7 @@
(:: p.Monad<Parser> map product.right (re-alternative^ true re-scoped^ current-module)))
## [Syntax]
-(syntax: #export (regex [pattern s.text])
+(syntax: #export (regex {pattern s.text})
{#.doc (doc "Create lexers using regular-expression syntax."
"For example:"
@@ -469,9 +469,9 @@
(wrap (list regex))
)))
-(syntax: #export (^regex [[pattern bindings] (s.form (p.seq s.text (p.maybe s.any)))]
+(syntax: #export (^regex {[pattern bindings] (s.form (p.seq s.text (p.maybe s.any)))}
body
- [branches (p.many s.any)])
+ {branches (p.many s.any)})
{#.doc (doc "Allows you to test text against regular expressions."
(case some-text
(^regex "(\\d{3})-(\\d{3})-(\\d{4})"
diff --git a/stdlib/source/lux/host.js.lux b/stdlib/source/lux/host.js.lux
index 7b96971cd..7ad985f1a 100644
--- a/stdlib/source/lux/host.js.lux
+++ b/stdlib/source/lux/host.js.lux
@@ -43,7 +43,7 @@
(wrap (list (` (:! (~ type)
("js get-field" (~ object) (~ field-name)))))))
-(syntax: #export (object [kvs (p.some (p.seq s.any s.any))])
+(syntax: #export (object {kvs (p.some (p.seq s.any s.any))})
{#.doc (doc "A way to create JavaScript objects."
(object)
(object "foo" foo "bar" (inc bar)))}
@@ -52,7 +52,8 @@
(` ("js object"))
kvs))))
-(syntax: #export (ref [name s.text] [type (p.maybe s.any)])
+(syntax: #export (ref {name s.text}
+ {type (p.maybe s.any)})
{#.doc (doc "A way to refer to JavaScript variables."
(ref "document")
(ref "Math.ceil" (-> Frac Frac)))}
@@ -69,8 +70,8 @@
[undef "js undefined" "Undefined."]
)
-(syntax: #export (call! [shape (p.alt ($_ p.seq s.any (s.tuple (p.some s.any)) (p.maybe s.any))
- ($_ p.seq s.any s.text (s.tuple (p.some s.any)) (p.maybe s.any)))])
+(syntax: #export (call! {shape (p.alt ($_ p.seq s.any (s.tuple (p.some s.any)) (p.maybe s.any))
+ ($_ p.seq s.any s.text (s.tuple (p.some s.any)) (p.maybe s.any)))})
{#.doc (doc "A way to call JavaScript functions and methods."
(call! (ref "Math.ceil") [123.45])
(call! (ref "Math") "ceil" [123.45]))}
diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux
index 78f418eb6..719f6dd6e 100644
--- a/stdlib/source/lux/host.jvm.lux
+++ b/stdlib/source/lux/host.jvm.lux
@@ -1272,20 +1272,21 @@
{#super-class-name "java/lang/Object"
#super-class-params (list)})
-(syntax: #export (class: [#let [imports (class-imports *compiler*)]]
- [im inheritance-modifier^]
- [class-decl (class-decl^ imports)]
- [#let [full-class-name (product.left class-decl)
+(syntax: #export (class:
+ {#let [imports (class-imports *compiler*)]}
+ {im inheritance-modifier^}
+ {class-decl (class-decl^ imports)}
+ {#let [full-class-name (product.left class-decl)
imports (add-import [(short-class-name full-class-name) full-class-name]
- (class-imports *compiler*))]]
- [#let [class-vars (product.right class-decl)]]
- [super (p.default object-super-class
- (super-class-decl^ imports class-vars))]
- [interfaces (p.default (list)
- (s.tuple (p.some (super-class-decl^ imports class-vars))))]
- [annotations (annotations^ imports)]
- [fields (p.some (field-decl^ imports class-vars))]
- [methods (p.some (method-def^ imports class-vars))])
+ (class-imports *compiler*))]}
+ {#let [class-vars (product.right class-decl)]}
+ {super (p.default object-super-class
+ (super-class-decl^ imports class-vars))}
+ {interfaces (p.default (list)
+ (s.tuple (p.some (super-class-decl^ imports class-vars))))}
+ {annotations (annotations^ imports)}
+ {fields (p.some (field-decl^ imports class-vars))}
+ {methods (p.some (method-def^ imports class-vars))})
{#.doc (doc "Allows defining JVM classes in Lux code."
"For example:"
(class: #final (TestClass A) [Runnable]
@@ -1334,16 +1335,17 @@
(with-brackets (spaced (list/map (method-def$ replacer super) methods))))))]]
(wrap (list (` ((~ (code.text def-code))))))))
-(syntax: #export (interface: [#let [imports (class-imports *compiler*)]]
- [class-decl (class-decl^ imports)]
- [#let [full-class-name (product.left class-decl)
+(syntax: #export (interface:
+ {#let [imports (class-imports *compiler*)]}
+ {class-decl (class-decl^ imports)}
+ {#let [full-class-name (product.left class-decl)
imports (add-import [(short-class-name full-class-name) full-class-name]
- (class-imports *compiler*))]]
- [#let [class-vars (product.right class-decl)]]
- [supers (p.default (list)
- (s.tuple (p.some (super-class-decl^ imports class-vars))))]
- [annotations (annotations^ imports)]
- [members (p.some (method-decl^ imports class-vars))])
+ (class-imports *compiler*))]}
+ {#let [class-vars (product.right class-decl)]}
+ {supers (p.default (list)
+ (s.tuple (p.some (super-class-decl^ imports class-vars))))}
+ {annotations (annotations^ imports)}
+ {members (p.some (method-decl^ imports class-vars))})
{#.doc (doc "Allows defining JVM interfaces."
(interface: TestInterface
([] foo [boolean String] void #throws [Exception])))}
@@ -1355,14 +1357,15 @@
(wrap (list (` ((~ (code.text def-code))))))
))
-(syntax: #export (object [#let [imports (class-imports *compiler*)]]
- [class-vars (s.tuple (p.some (type-param^ imports)))]
- [super (p.default object-super-class
- (super-class-decl^ imports class-vars))]
- [interfaces (p.default (list)
- (s.tuple (p.some (super-class-decl^ imports class-vars))))]
- [constructor-args (constructor-args^ imports class-vars)]
- [methods (p.some (overriden-method-def^ imports))])
+(syntax: #export (object
+ {#let [imports (class-imports *compiler*)]}
+ {class-vars (s.tuple (p.some (type-param^ imports)))}
+ {super (p.default object-super-class
+ (super-class-decl^ imports class-vars))}
+ {interfaces (p.default (list)
+ (s.tuple (p.some (super-class-decl^ imports class-vars))))}
+ {constructor-args (constructor-args^ imports class-vars)}
+ {methods (p.some (overriden-method-def^ imports))})
{#.doc (doc "Allows defining anonymous classes."
"The 1st tuple corresponds to parent interfaces."
"The 2nd tuple corresponds to arguments to the super class constructor."
@@ -1435,9 +1438,9 @@
(with-gensyms [g!_]
(wrap (list (`' ("lux try" (.function ((~ g!_) (~ g!_)) (~ expr))))))))
-(syntax: #export (instance? [#let [imports (class-imports *compiler*)]]
- [class (generic-type^ imports (list))]
- [obj (p.maybe s.any)])
+(syntax: #export (instance? {#let [imports (class-imports *compiler*)]}
+ {class (generic-type^ imports (list))}
+ {obj (p.maybe s.any)})
{#.doc (doc "Checks whether an object is an instance of a particular class."
"Caveat emptor: Cannot check for polymorphism, so avoid using parameterized classes."
(instance? String "YOLO"))}
@@ -1462,7 +1465,9 @@
(finish-the-computation ___))))}
(wrap (list (` ("jvm object synchronized" (~ lock) (~ body))))))
-(syntax: #export (do-to obj [methods (p.some partial-call^)])
+(syntax: #export (do-to
+ obj
+ {methods (p.some partial-call^)})
{#.doc (doc "Call a variety of methods on an object. Then, return the object."
(do-to object
(ClassName::method1 [arg0 arg1 arg2])
@@ -1850,13 +1855,14 @@
(#.Left _)
(macro.fail (format "Unknown class: " class-name)))))
-(syntax: #export (import [#let [imports (class-imports *compiler*)]]
- [long-name? (s.this? (' #long))]
- [class-decl (class-decl^ imports)]
- [#let [full-class-name (product.left class-decl)
+(syntax: #export (import
+ {#let [imports (class-imports *compiler*)]}
+ {long-name? (s.this? (' #long))}
+ {class-decl (class-decl^ imports)}
+ {#let [full-class-name (product.left class-decl)
imports (add-import [(short-class-name full-class-name) full-class-name]
- (class-imports *compiler*))]]
- [members (p.some (import-member-decl^ imports (product.right class-decl)))])
+ (class-imports *compiler*))]}
+ {members (p.some (import-member-decl^ imports (product.right class-decl)))})
{#.doc (doc "Allows importing JVM classes, and using them as types."
"Their methods, fields and enum options can also be imported."
"Also, classes which get imported into a module can also be referred-to with their short names in other macros that require JVM classes."
@@ -1908,8 +1914,8 @@
=members (monad.map @ (member-import$ (product.right class-decl) long-name? kind class-decl) members)]
(wrap (list& (class-import$ long-name? class-decl) (list/join =members)))))
-(syntax: #export (array [#let [imports (class-imports *compiler*)]]
- [type (generic-type^ imports (list))]
+(syntax: #export (array {#let [imports (class-imports *compiler*)]}
+ {type (generic-type^ imports (list))}
size)
{#.doc (doc "Create an array of the given type, with the given size."
(array Object +10))}
@@ -2020,7 +2026,9 @@
(Syntax (List [Text Code]))
(s.tuple (p.some (p.seq s.local-symbol s.any))))
-(syntax: #export (with-open [bindings simple-bindings^] body)
+(syntax: #export (with-open
+ {bindings simple-bindings^}
+ body)
{#.doc (doc "Creates a local-binding with the desired resources, and runs the body (assumed to be in the IO type)."
"Afterwards, closes all resources (assumed to be subclasses of java.io.Closeable), and returns the value resulting from running the body."
(with-open [my-res1 (res1-constructor ___)
@@ -2042,8 +2050,8 @@
(~' #let) [(~ g!_) (exec (~+ (list.reverse closes)) [])]]
((~' wrap) (~ g!output)))))))))
-(syntax: #export (class-for [#let [imports (class-imports *compiler*)]]
- [type (generic-type^ imports (list))])
+(syntax: #export (class-for {#let [imports (class-imports *compiler*)]}
+ {type (generic-type^ imports (list))})
{#.doc (doc "Loads the class as a java.lang.Class object."
(class-for java/lang/String))}
(wrap (list (` ("jvm object class" (~ (code.text (simple-class$ (list) type))))))))
@@ -2063,6 +2071,6 @@
[*compiler* get-compiler]
(wrap (qualify (class-imports *compiler*) class))))
-(syntax: #export (type [#let [imports (class-imports *compiler*)]]
- [type (generic-type^ imports (list))])
+(syntax: #export (type {#let [imports (class-imports *compiler*)]}
+ {type (generic-type^ imports (list))})
(wrap (list (class->type #ManualPrM (list) type))))
diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux
index 0c30eb9c2..b9336139b 100644
--- a/stdlib/source/lux/macro/poly.lux
+++ b/stdlib/source/lux/macro/poly.lux
@@ -363,12 +363,12 @@
(p.fail "LOGGING")))
## [Syntax]
-(syntax: #export (poly: [export csr.export]
- [name s.local-symbol]
+(syntax: #export (poly: {export csr.export}
+ {name s.local-symbol}
body)
(with-gensyms [g!_ g!type g!output]
(let [g!name (code.symbol ["" name])]
- (wrap (.list (` (syntax: (~+ (csw.export export)) ((~ g!name) [(~ g!type) s.symbol])
+ (wrap (.list (` (syntax: (~+ (csw.export export)) ((~ g!name) {(~ g!type) s.symbol})
(do macro.Monad<Meta>
[(~ g!type) (macro.find-type-def (~ g!type))]
(case (|> (~ body)
@@ -393,10 +393,10 @@
(#.Some (list/fold (text.replace-once "?") poly args))
#.None))
-(syntax: #export (derived: [export csr.export]
- [?name (p.maybe s.local-symbol)]
- [[poly-func poly-args] (s.form (p.seq s.symbol (p.many s.symbol)))]
- [?custom-impl (p.maybe s.any)])
+(syntax: #export (derived: {export csr.export}
+ {?name (p.maybe s.local-symbol)}
+ {[poly-func poly-args] (s.form (p.seq s.symbol (p.many s.symbol)))}
+ {?custom-impl (p.maybe s.any)})
(do @
[poly-args (monad.map @ macro.normalize poly-args)
name (case ?name
diff --git a/stdlib/source/lux/macro/syntax.lux b/stdlib/source/lux/macro/syntax.lux
index 536366a8f..a3831f3fe 100644
--- a/stdlib/source/lux/macro/syntax.lux
+++ b/stdlib/source/lux/macro/syntax.lux
@@ -199,12 +199,12 @@
"The inputs to the macro can be parsed in complex ways through the use of syntax parsers."
"The macro body is also (implicitly) run in the Monad<Meta>, to save some typing."
"Also, the compiler state can be accessed through the *compiler* binding."
- (syntax: #export (object [#let [imports (class-imports *compiler*)]]
- [#let [class-vars (list)]]
- [super (opt (super-class-decl^ imports class-vars))]
- [interfaces (tuple (some (super-class-decl^ imports class-vars)))]
- [constructor-args (constructor-args^ imports class-vars)]
- [methods (some (overriden-method-def^ imports))])
+ (syntax: #export (object {#let [imports (class-imports *compiler*)]}
+ {#let [class-vars (list)]}
+ {super (opt (super-class-decl^ imports class-vars))}
+ {interfaces (tuple (some (super-class-decl^ imports class-vars)))}
+ {constructor-args (constructor-args^ imports class-vars)}
+ {methods (some (overriden-method-def^ imports))})
(let [def-code ($_ text/compose "anon-class:"
(spaced (list (super-class-decl$ (maybe.default object-super-class super))
(with-brackets (spaced (list/map super-class-decl$ interfaces)))
@@ -239,7 +239,7 @@
(: (-> Code (Meta [Code Code]))
(function (_ arg)
(case arg
- (^ [_ (#.Tuple (list var parser))])
+ (^ [_ (#.Record (list [var parser]))])
(wrap [var parser])
[_ (#.Symbol var-name)]
diff --git a/stdlib/source/lux/math.lux b/stdlib/source/lux/math.lux
index eea41c040..25cf120a3 100644
--- a/stdlib/source/lux/math.lux
+++ b/stdlib/source/lux/math.lux
@@ -241,7 +241,7 @@
(` ((~ op) (~ (infix-to-prefix right)) (~ (infix-to-prefix left))))
))
-(syntax: #export (infix [expr infix^])
+(syntax: #export (infix {expr infix^})
{#.doc (doc "Infix math syntax."
(infix [x i/* 10])
(infix [[x i/+ y] i/* [x i/- y]])
diff --git a/stdlib/source/lux/math/constructive.lux b/stdlib/source/lux/math/constructive.lux
index 4cc1a839e..f9192bdee 100644
--- a/stdlib/source/lux/math/constructive.lux
+++ b/stdlib/source/lux/math/constructive.lux
@@ -33,7 +33,7 @@
(.|>> @representation))
)
-(syntax: #export (@ [name s.symbol])
+(syntax: #export (@ {name s.symbol})
(do @
[witnessT (macro.find-type name)]
(.case (.<| (poly.run witnessT)
@@ -47,8 +47,9 @@
(#e.Error error)
(macro.fail error))))
-(syntax: #export (proof: [export? scr.export]
- [name s.local-symbol]
+(syntax: #export (proof:
+ {export? scr.export}
+ {name s.local-symbol}
type
proof)
(do @
@@ -107,9 +108,10 @@
(s.Syntax [.Text (.List .Text)])
(s.form (p.seq s.local-symbol (p.many s.local-symbol))))
-(syntax: #export (proposition: [export? scr.export]
- [[name elements] proposition-declaration]
- [meaning (p.maybe s.any)])
+(syntax: #export (proposition:
+ {export? scr.export}
+ {[name elements] proposition-declaration}
+ {meaning (p.maybe s.any)})
(.case meaning
#.None
(wrap (.list (.` ((~! abstract:) (~+ (scw.export export?))
@@ -146,11 +148,11 @@
(.Ex [(~+ g!identities)]
(-> (~+ g!requisites) (~ meaning)))))))
-(syntax: #export (axiom [description (p.default "" s.text)])
+(syntax: #export (axiom {description (p.default "" s.text)})
(wrap (.list (.` (.:!! [])))))
-(syntax: #export (theorem [type-vars type-vars]
- [[name inputs] theorem-declaration]
+(syntax: #export (theorem {type-vars type-vars}
+ {[name inputs] theorem-declaration}
outputT
meaning)
(.let [inputs-names (list/map (.|>> input-name code.local-symbol)
@@ -168,9 +170,10 @@
(#Anonymous [name type])
(.` [(~ (code.local-symbol name)) (~ type)])))
-(syntax: #export (theorem: [export? scr.export]
- [type-vars type-vars]
- [[name inputs] theorem-declaration]
+(syntax: #export (theorem:
+ {export? scr.export}
+ {type-vars type-vars}
+ {[name inputs] theorem-declaration}
outputT
meaning)
(wrap (.list (.` (..proof: (~+ (scw.export export?))
diff --git a/stdlib/source/lux/math/modular.lux b/stdlib/source/lux/math/modular.lux
index 068f688e2..7c71b86b1 100644
--- a/stdlib/source/lux/math/modular.lux
+++ b/stdlib/source/lux/math/modular.lux
@@ -51,7 +51,7 @@
(i/% (to-int modulus))
(i/= 0)))
-(syntax: #export (modulus [modulus s.int])
+(syntax: #export (modulus {modulus s.int})
(case (from-int modulus)
(#e.Success _)
(wrap (list (` (e.assume (..from-int (~ (code.int modulus)))))))
diff --git a/stdlib/source/lux/type/abstract.lux b/stdlib/source/lux/type/abstract.lux
index 9f54f3036..c23e3f456 100644
--- a/stdlib/source/lux/type/abstract.lux
+++ b/stdlib/source/lux/type/abstract.lux
@@ -106,8 +106,8 @@
(#E.Success [(update@ #.modules (put this-module-name this-module) compiler)
[]]))))
-(syntax: (install-casts [name s.local-symbol]
- [type-vars (s.tuple (p.some s.local-symbol))])
+(syntax: (install-casts {name s.local-symbol}
+ {type-vars (s.tuple (p.some s.local-symbol))})
(do @
[this-module-name macro.current-module-name
?down-cast (macro.find-macro [this-module-name down-cast])
@@ -146,11 +146,12 @@
(p.either (s.form (p.seq s.local-symbol (p.some s.local-symbol)))
(p.seq s.local-symbol (:: p.Monad<Parser> wrap (list)))))
-(syntax: #export (abstract: [export csr.export]
- [[name type-vars] declaration]
- [annotations (p.default cs.empty-annotations csr.annotations)]
+(syntax: #export (abstract:
+ {export csr.export}
+ {[name type-vars] declaration}
+ {annotations (p.default cs.empty-annotations csr.annotations)}
representation-type
- [primitives (p.some s.any)])
+ {primitives (p.some s.any)})
(let [hidden-name (representation-name name)
type-varsC (list/map code.local-symbol type-vars)
abstract-declaration (` ((~ (code.local-symbol name)) (~+ type-varsC)))
@@ -164,7 +165,9 @@
(list/compose primitives
(list (` ((~! un-install-casts)))))))))
-(syntax: #export (^@representation [name (s.form s.local-symbol)] body [branches (p.some s.any)])
+(syntax: #export (^@representation {name (s.form s.local-symbol)}
+ body
+ {branches (p.some s.any)})
(let [g!representation (code.local-symbol name)]
(do @
[current-module macro.current-module-name
diff --git a/stdlib/source/lux/type/implicit.lux b/stdlib/source/lux/type/implicit.lux
index bc361d5e5..40ccde862 100644
--- a/stdlib/source/lux/type/implicit.lux
+++ b/stdlib/source/lux/type/implicit.lux
@@ -304,9 +304,10 @@
_
(` ((~ (code.symbol constructor)) (~+ (list/map instance$ dependencies))))))
-(syntax: #export (::: [member s.symbol]
- [args (p.alt (p.seq (p.some s.symbol) s.end!)
- (p.seq (p.some s.any) s.end!))])
+(syntax: #export (:::
+ {member s.symbol}
+ {args (p.alt (p.seq (p.some s.symbol) s.end!)
+ (p.seq (p.some s.any) s.end!))})
{#.doc (doc "Automatic structure selection (for type-class style polymorphism)."
"This feature layers type-class style polymorphism on top of Lux's signatures and structures."
"When calling a polymorphic function, or using a polymorphic constant,"
diff --git a/stdlib/source/lux/type/object/interface.lux b/stdlib/source/lux/type/object/interface.lux
index a572985ad..e3a9f582c 100644
--- a/stdlib/source/lux/type/object/interface.lux
+++ b/stdlib/source/lux/type/object/interface.lux
@@ -358,12 +358,13 @@
_
(macro.fail (format "Cannot convert type to code: " (type.to-text type)))))
-(syntax: #export (interface: [export csr.export]
- [(^@ decl [interface parameters]) declarationS]
- [?extends (p.maybe extension)]
- [alias aliasS]
- [annotations (p.default cs.empty-annotations csr.annotations)]
- [methods (p.many (method (var-set parameters)))])
+(syntax: #export (interface:
+ {export csr.export}
+ {(^@ decl [interface parameters]) declarationS}
+ {?extends (p.maybe extension)}
+ {alias aliasS}
+ {annotations (p.default cs.empty-annotations csr.annotations)}
+ {methods (p.many (method (var-set parameters)))})
(macro.with-gensyms [g!self-class g!child g!ext]
(do @
[module macro.current-module-name
@@ -425,13 +426,14 @@
methods))))
)))
-(syntax: #export (class: [export csr.export]
- [[instance parameters] declarationS]
- [annotations (p.default cs.empty-annotations csr.annotations)]
- [[interface interface-mappings] referenceS]
- [super (p.maybe inheritance)]
+(syntax: #export (class:
+ {export csr.export}
+ {[instance parameters] declarationS}
+ {annotations (p.default cs.empty-annotations csr.annotations)}
+ {[interface interface-mappings] referenceS}
+ {super (p.maybe inheritance)}
state-type
- [impls (p.many s.any)])
+ {impls (p.many s.any)})
(macro.with-gensyms [g!init g!extension]
(do @
[module macro.current-module-name
diff --git a/stdlib/source/lux/type/object/protocol.lux b/stdlib/source/lux/type/object/protocol.lux
index f9a5158da..3499b436a 100644
--- a/stdlib/source/lux/type/object/protocol.lux
+++ b/stdlib/source/lux/type/object/protocol.lux
@@ -138,9 +138,10 @@
(sum.either (method|c export protocol)
(class|c export protocol)))
-(syntax: #export (protocol: [export csr.export]
- [declaration csr.declaration]
- [supers (p.many super|r)])
+(syntax: #export (protocol:
+ {export csr.export}
+ {declaration csr.declaration}
+ {supers (p.many super|r)})
(macro.with-gensyms [g!return]
(do @
[constructors (monad.map @ (super|c export declaration) supers)
diff --git a/stdlib/source/lux/type/quotient.lux b/stdlib/source/lux/type/quotient.lux
index 205d8d579..2be136009 100644
--- a/stdlib/source/lux/type/quotient.lux
+++ b/stdlib/source/lux/type/quotient.lux
@@ -56,7 +56,7 @@
($_ p.seq poly.any poly.any poly.existential))]
(wrap (.type (..Quotient valueT classT (~ (#.Ex quotient-ex))))))))
-(syntax: #export (type [quotient s.symbol])
+(syntax: #export (type {quotient s.symbol})
(do @
[constructorT (macro.find-type quotient)
quotientT (case (quotient-type constructorT)
diff --git a/stdlib/source/lux/type/refinement.lux b/stdlib/source/lux/type/refinement.lux
index a2058d229..051166eb9 100644
--- a/stdlib/source/lux/type/refinement.lux
+++ b/stdlib/source/lux/type/refinement.lux
@@ -60,7 +60,7 @@
poly.existential)]
(wrap (.type (..Ref un-refinedT (#.Ex refined-ex)))))))
-(syntax: #export (type [refinement s.symbol])
+(syntax: #export (type {refinement s.symbol})
(do @
[constructorT (macro.find-type refinement)
refinementT (case (refinement-type constructorT)
diff --git a/stdlib/source/lux/type/resource.lux b/stdlib/source/lux/type/resource.lux
index 15c51c8ef..f25f322de 100644
--- a/stdlib/source/lux/type/resource.lux
+++ b/stdlib/source/lux/type/resource.lux
@@ -141,7 +141,7 @@
(function (_ context) (:: Monad<m> wrap [context []])))
(do-template [<name> <m> <monad>]
- [(syntax: #export (<name> [swaps ..indices])
+ [(syntax: #export (<name> {swaps ..indices})
(macro.with-gensyms [g!_ g!context]
(case swaps
#.Nil
@@ -183,7 +183,7 @@
(wrap raw)))
(do-template [<name> <m> <monad> <from> <to>]
- [(syntax: #export (<name> [amount amount])
+ [(syntax: #export (<name> {amount ..amount})
(macro.with-gensyms [g!_ g!context]
(do macro.Monad<Meta>
[g!keys (<| (monad.seq @) (list.repeat amount) (macro.gensym "keys"))]
diff --git a/stdlib/source/lux/type/unit.lux b/stdlib/source/lux/type/unit.lux
index 7bbaf93b4..1615a47c7 100644
--- a/stdlib/source/lux/type/unit.lux
+++ b/stdlib/source/lux/type/unit.lux
@@ -61,9 +61,10 @@
[scale-name #..Scale]
)
-(syntax: #export (unit: [export csr.export]
- [name s.local-symbol]
- [annotations (p.default cs.empty-annotations csr.annotations)])
+(syntax: #export (unit:
+ {export csr.export}
+ {name s.local-symbol}
+ {annotations (p.default cs.empty-annotations csr.annotations)})
(wrap (list (` (type: (~+ (csw.export export)) (~ (code.local-symbol name))
(~ (csw.annotations annotations))
(primitive (~ (code.text (unit-name name))))))
@@ -83,10 +84,11 @@
(i/> 0 denominator))]
(wrap [(int-to-nat numerator) (int-to-nat denominator)]))))
-(syntax: #export (scale: [export csr.export]
- [name s.local-symbol]
- [(^slots [#r.numerator #r.denominator]) ratio^]
- [annotations (p.default cs.empty-annotations csr.annotations)])
+(syntax: #export (scale:
+ {export csr.export}
+ {name s.local-symbol}
+ {(^slots [#r.numerator #r.denominator]) ratio^}
+ {annotations (p.default cs.empty-annotations csr.annotations)})
(let [g!scale (code.local-symbol name)]
(wrap (list (` (type: (~+ (csw.export export)) ((~ g!scale) (~' u))
(~ (csw.annotations annotations))