aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stdlib/source/lux/concurrency/actor.lux8
-rw-r--r--stdlib/source/lux/control/concatenative.lux2
-rw-r--r--stdlib/source/lux/control/parser.lux20
-rw-r--r--stdlib/source/lux/control/pipe.lux2
-rw-r--r--stdlib/source/lux/data/format/xml.lux6
-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/regex.lux4
-rw-r--r--stdlib/source/lux/host.js.lux6
-rw-r--r--stdlib/source/lux/host.jvm.lux18
-rw-r--r--stdlib/source/lux/macro/poly.lux4
-rw-r--r--stdlib/source/lux/macro/syntax/common/reader.lux4
-rw-r--r--stdlib/source/lux/test.lux2
-rw-r--r--stdlib/source/lux/time/date.lux2
-rw-r--r--stdlib/source/lux/time/instant.lux2
-rw-r--r--stdlib/source/lux/type/object.lux4
-rw-r--r--stdlib/test/test/lux/control/parser.lux4
17 files changed, 46 insertions, 46 deletions
diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux
index 7824446bd..b42a54a33 100644
--- a/stdlib/source/lux/concurrency/actor.lux
+++ b/stdlib/source/lux/concurrency/actor.lux
@@ -193,10 +193,10 @@
(s;Syntax BehaviorC)
(let [handle-args ($_ p;seq s;local-symbol s;local-symbol s;local-symbol)
stop-args ($_ p;seq s;local-symbol s;local-symbol)]
- (p;seq (p;opt (s;form (p;seq (s;form (p;after (s;this (' handle)) handle-args))
- s;any)))
- (p;opt (s;form (p;seq (s;form (p;after (s;this (' stop)) stop-args))
- s;any))))))
+ (p;seq (p;maybe (s;form (p;seq (s;form (p;after (s;this (' handle)) handle-args))
+ s;any)))
+ (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^]
diff --git a/stdlib/source/lux/control/concatenative.lux b/stdlib/source/lux/control/concatenative.lux
index e96677b64..1459a41ab 100644
--- a/stdlib/source/lux/control/concatenative.lux
+++ b/stdlib/source/lux/control/concatenative.lux
@@ -36,7 +36,7 @@
(def: stack^
(s;Syntax Stack)
- (p;either (p;seq (p;opt bottom^)
+ (p;either (p;seq (p;maybe bottom^)
(s;tuple (p;some s;any)))
(p;seq (|> bottom^ (p/map (|>. #;Some)))
(p/wrap (list)))))
diff --git a/stdlib/source/lux/control/parser.lux b/stdlib/source/lux/control/parser.lux
index 87d6820bd..606d8d448 100644
--- a/stdlib/source/lux/control/parser.lux
+++ b/stdlib/source/lux/control/parser.lux
@@ -1,10 +1,10 @@
(;module:
[lux #- not]
- (lux (control ["F" functor]
- ["A" applicative]
- ["M" monad #+ do Monad]
+ (lux (control [functor #+ Functor]
+ [applicative #+ Applicative]
+ [monad #+ do Monad]
[codec])
- (data (coll [list "L/" Functor<List> Monoid<List>])
+ (data (coll [list "list/" Functor<List> Monoid<List>])
[product]
["R" result])))
@@ -13,7 +13,7 @@
(-> s (R;Result [s a])))
## [Structures]
-(struct: #export Functor<Parser> (All [s] (F;Functor (Parser s)))
+(struct: #export Functor<Parser> (All [s] (Functor (Parser s)))
(def: (map f ma)
(function [input]
(case (ma input)
@@ -23,7 +23,7 @@
(#R;Success [input' a])
(#R;Success [input' (f a)])))))
-(struct: #export Applicative<Parser> (All [s] (A;Applicative (Parser s)))
+(struct: #export Applicative<Parser> (All [s] (Applicative (Parser s)))
(def: functor Functor<Parser>)
(def: (wrap x)
@@ -65,7 +65,7 @@
(#R;Success [input []])
(#R;Error message))))
-(def: #export (opt p)
+(def: #export (maybe p)
{#;doc "Optionality combinator."}
(All [s a]
(-> (Parser s a) (Parser s (Maybe a))))
@@ -149,7 +149,7 @@
(do Monad<Parser>
[min (exactly n p)
extra (some p)]
- (wrap (L/compose min extra))))
+ (wrap (list/compose min extra))))
(def: #export (at-most n p)
{#;doc "Parse at most N times."}
@@ -180,7 +180,7 @@
{#;doc "Parsers instances of 'p' that are separated by instances of 'sep'."}
(All [s a b] (-> (Parser s b) (Parser s a) (Parser s (List a))))
(do Monad<Parser>
- [?x (opt p)]
+ [?x (maybe p)]
(case ?x
#;None
(wrap #;Nil)
@@ -188,7 +188,7 @@
(#;Some x)
(do @
[xs' (some (seq sep p))]
- (wrap (#;Cons x (L/map product;right xs'))))
+ (wrap (#;Cons x (list/map product;right xs'))))
)))
(def: #export (not p)
diff --git a/stdlib/source/lux/control/pipe.lux b/stdlib/source/lux/control/pipe.lux
index e74ca1f06..543c4c769 100644
--- a/stdlib/source/lux/control/pipe.lux
+++ b/stdlib/source/lux/control/pipe.lux
@@ -44,7 +44,7 @@
body))))
(syntax: #export (?> [branches (p;many (p;seq body^ body^))]
- [?else (p;opt body^)]
+ [?else (p;maybe body^)]
prev)
{#;doc (doc "Branching for pipes."
"Both the tests and the bodies are piped-code, and must be given inside a tuple."
diff --git a/stdlib/source/lux/data/format/xml.lux b/stdlib/source/lux/data/format/xml.lux
index 3763ca63b..2be7afdd3 100644
--- a/stdlib/source/lux/data/format/xml.lux
+++ b/stdlib/source/lux/data/format/xml.lux
@@ -37,7 +37,7 @@
(def: xml-unicode-escape-char^
(l;Lexer Text)
(|> (do p;Monad<Parser>
- [hex? (p;opt (l;this "x"))
+ [hex? (p;maybe (l;this "x"))
code (case hex?
#;None
(p;codec number;Codec<Text,Int> (l;many l;decimal))
@@ -71,7 +71,7 @@
(l;Lexer Ident)
(do p;Monad<Parser>
[first-part xml-identifier
- ?second-part (<| p;opt (p;after (l;this ":")) xml-identifier)]
+ ?second-part (<| p;maybe (p;after (l;this ":")) xml-identifier)]
(case ?second-part
#;None
(wrap ["" first-part])
@@ -167,7 +167,7 @@
## This way, the comments can only be before or after the main document.
(p;before (p;some comment^))
(p;after (p;some comment^))
- (p;after (p;opt xml-header^))))
+ (p;after (p;maybe xml-header^))))
(def: #export (read input)
(-> Text (R;Result XML))
diff --git a/stdlib/source/lux/data/number/complex.lux b/stdlib/source/lux/data/number/complex.lux
index e8bcb2268..d2933a1ab 100644
--- a/stdlib/source/lux/data/number/complex.lux
+++ b/stdlib/source/lux/data/number/complex.lux
@@ -23,7 +23,7 @@
{#real Frac
#imaginary Frac})
-(syntax: #export (complex real [?imaginary (p;opt 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 51e9464b1..391242a32 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;opt 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/regex.lux b/stdlib/source/lux/data/text/regex.lux
index 2625885b2..11139cd6a 100644
--- a/stdlib/source/lux/data/text/regex.lux
+++ b/stdlib/source/lux/data/text/regex.lux
@@ -98,7 +98,7 @@
(def: re-user-class^'
(l;Lexer Code)
(do p;Monad<Parser>
- [negate? (p;opt (l;this "^"))
+ [negate? (p;maybe (l;this "^"))
parts (p;many ($_ p;either
re-range^
re-options^))]
@@ -470,7 +470,7 @@
(wrap (list regex))
)))
-(syntax: #export (^regex [[pattern bindings] (s;form (p;seq s;text (p;opt s;any)))]
+(syntax: #export (^regex [[pattern bindings] (s;form (p;seq s;text (p;maybe s;any)))]
body
[branches (p;many s;any)])
{#;doc (doc "Allows you to test text against regular expressions."
diff --git a/stdlib/source/lux/host.js.lux b/stdlib/source/lux/host.js.lux
index 258de1b8d..5f334fb46 100644
--- a/stdlib/source/lux/host.js.lux
+++ b/stdlib/source/lux/host.js.lux
@@ -52,7 +52,7 @@
(` (;_lux_proc ["js" "object"] []))
kvs))))
-(syntax: #export (ref [name s;text] [type (p;opt 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 +69,8 @@
[undef "undefined" "Undefined."]
)
-(syntax: #export (call! [shape (p;alt ($_ p;seq s;any (s;tuple (p;some s;any)) (p;opt s;any))
- ($_ p;seq s;any s;text (s;tuple (p;some s;any)) (p;opt 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 be8a4bf7b..d5e9a7837 100644
--- a/stdlib/source/lux/host.jvm.lux
+++ b/stdlib/source/lux/host.jvm.lux
@@ -754,7 +754,7 @@
(def: (annotations^ imports)
(-> ClassImports (Syntax (List Annotation)))
(do p;Monad<Parser>
- [anns?? (p;opt (annotations^' imports))]
+ [anns?? (p;maybe (annotations^' imports))]
(wrap (maybe;default (list) anns??))))
(def: (throws-decl'^ imports type-vars)
@@ -766,7 +766,7 @@
(def: (throws-decl^ imports type-vars)
(-> ClassImports (List TypeParam) (Syntax (List GenericType)))
(do p;Monad<Parser>
- [exs? (p;opt (throws-decl'^ imports type-vars))]
+ [exs? (p;maybe (throws-decl'^ imports type-vars))]
(wrap (maybe;default (list) exs?))))
(def: (method-decl^ imports type-vars)
@@ -958,9 +958,9 @@
(def: import-member-alias^
(Syntax (Maybe Text))
- (p;opt (do p;Monad<Parser>
- [_ (s;this (' #as))]
- s;local-symbol)))
+ (p;maybe (do p;Monad<Parser>
+ [_ (s;this (' #as))]
+ s;local-symbol)))
(def: (import-member-args^ imports type-vars)
(-> ClassImports (List TypeParam) (Syntax (List [Bool GenericType])))
@@ -987,7 +987,7 @@
_ (s;this (' new))
?alias import-member-alias^
#let [total-vars (list/compose owner-vars tvars)]
- ?prim-mode (p;opt primitive-mode^)
+ ?prim-mode (p;maybe primitive-mode^)
args (import-member-args^ imports total-vars)
[io? try? maybe?] import-member-return-flags^]
(wrap (#ConstructorDecl [{#import-member-mode (maybe;default #AutoPrM ?prim-mode)
@@ -1008,7 +1008,7 @@
name s;local-symbol
?alias import-member-alias^
#let [total-vars (list/compose owner-vars tvars)]
- ?prim-mode (p;opt primitive-mode^)
+ ?prim-mode (p;maybe primitive-mode^)
args (import-member-args^ imports total-vars)
[io? try? maybe?] import-member-return-flags^
return (generic-type^ imports total-vars)]
@@ -1026,7 +1026,7 @@
(s;form (do p;Monad<Parser>
[static? (s;this? (' #static))
name s;local-symbol
- ?prim-mode (p;opt primitive-mode^)
+ ?prim-mode (p;maybe primitive-mode^)
gtype (generic-type^ imports owner-vars)
maybe? (s;this? (' #?))
setter? (s;this? (' #!))]
@@ -1425,7 +1425,7 @@
(syntax: #export (instance? [#let [imports (class-imports *compiler*)]]
[class (generic-type^ imports (list))]
- [obj (p;opt s;any)])
+ [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"))}
diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux
index e23353593..d744a28f7 100644
--- a/stdlib/source/lux/macro/poly.lux
+++ b/stdlib/source/lux/macro/poly.lux
@@ -368,9 +368,9 @@
#;None))
(syntax: #export (derived: [export csr;export]
- [?name (p;opt s;local-symbol)]
+ [?name (p;maybe s;local-symbol)]
[[poly-func poly-args] (s;form (p;seq s;symbol (p;many s;symbol)))]
- [?custom-impl (p;opt s;any)])
+ [?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/common/reader.lux b/stdlib/source/lux/macro/syntax/common/reader.lux
index 460dabbf6..aa5743f76 100644
--- a/stdlib/source/lux/macro/syntax/common/reader.lux
+++ b/stdlib/source/lux/macro/syntax/common/reader.lux
@@ -17,8 +17,8 @@
#export
#hidden)}
(Syntax (Maybe Export))
- (p;opt (p;alt (s;this (' #export))
- (s;this (' #hidden)))))
+ (p;maybe (p;alt (s;this (' #export))
+ (s;this (' #hidden)))))
## Declarations
(def: #export declaration
diff --git a/stdlib/source/lux/test.lux b/stdlib/source/lux/test.lux
index f62c35551..6d21a074b 100644
--- a/stdlib/source/lux/test.lux
+++ b/stdlib/source/lux/test.lux
@@ -144,7 +144,7 @@
(def: property-test^
(Syntax Property-Test)
($_ p;seq
- (p;opt config^)
+ (p;maybe config^)
(s;tuple (p;some (p;seq s;any s;any)))
s;any))
diff --git a/stdlib/source/lux/time/date.lux b/stdlib/source/lux/time/date.lux
index dc63ca7ab..9f2d2972b 100644
--- a/stdlib/source/lux/time/date.lux
+++ b/stdlib/source/lux/time/date.lux
@@ -234,7 +234,7 @@
(def: lex-year
(l;Lexer Int)
(do p;Monad<Parser>
- [sign? (p;opt (l;this "-"))
+ [sign? (p;maybe (l;this "-"))
raw-year (p;codec number;Codec<Text,Int> (l;many l;decimal))
#let [signum (case sign?
#;None 1
diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux
index f93cfbad4..c76f108fb 100644
--- a/stdlib/source/lux/time/instant.lux
+++ b/stdlib/source/lux/time/instant.lux
@@ -214,7 +214,7 @@
(def: lex-year
(l;Lexer Int)
(do p;Monad<Parser>
- [sign? (p;opt (l;this "-"))
+ [sign? (p;maybe (l;this "-"))
raw-year (p;codec number;Codec<Text,Int> (l;many l;decimal))
#let [signum (case sign?
#;None 1
diff --git a/stdlib/source/lux/type/object.lux b/stdlib/source/lux/type/object.lux
index 3ab6bee4e..02306554b 100644
--- a/stdlib/source/lux/type/object.lux
+++ b/stdlib/source/lux/type/object.lux
@@ -361,7 +361,7 @@
(syntax: #export (interface: [export csr;export]
[(^@ decl [interface parameters]) declarationS]
- [?extends (p;opt extension)]
+ [?extends (p;maybe extension)]
[alias aliasS]
[annotations (p;default cs;empty-annotations csr;annotations)]
[methods (p;many (method (var-set parameters)))])
@@ -430,7 +430,7 @@
[[instance parameters] declarationS]
[annotations (p;default cs;empty-annotations csr;annotations)]
[[interface interface-mappings] referenceS]
- [super (p;opt inheritance)]
+ [super (p;maybe inheritance)]
state-type
[impls (p;many s;any)])
(macro;with-gensyms [g!init g!extension]
diff --git a/stdlib/test/test/lux/control/parser.lux b/stdlib/test/test/lux/control/parser.lux
index df3e9f364..ae3fc2041 100644
--- a/stdlib/test/test/lux/control/parser.lux
+++ b/stdlib/test/test/lux/control/parser.lux
@@ -82,10 +82,10 @@
(test "Can optionally succeed with some parser."
(and (match (#;Some +123)
(&;run (list (code;nat +123))
- (&;opt s;nat)))
+ (&;maybe s;nat)))
(match #;None
(&;run (list (code;int -123))
- (&;opt s;nat)))))
+ (&;maybe s;nat)))))
(test "Can apply a parser 0 or more times."
(and (match (list +123 +456 +789)