aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation
diff options
context:
space:
mode:
authorEduardo Julian2022-03-16 08:37:23 -0400
committerEduardo Julian2022-03-16 08:37:23 -0400
commitbf53ee92fc3c33a4885aa227e55d24f7ba3cb2c4 (patch)
tree49683a62ae8e110c62b42a9a6386bb2ddb3c47c6 /stdlib/source/documentation
parentd710d9f4fc098e7c243c8a5f23cd42683f13e07f (diff)
De-sigil-ification: prefix :
Diffstat (limited to 'stdlib/source/documentation')
-rw-r--r--stdlib/source/documentation/lux.lux146
-rw-r--r--stdlib/source/documentation/lux/abstract/codec.lux20
-rw-r--r--stdlib/source/documentation/lux/control/concatenative.lux36
-rw-r--r--stdlib/source/documentation/lux/control/exception.lux30
-rw-r--r--stdlib/source/documentation/lux/control/security/policy.lux22
-rw-r--r--stdlib/source/documentation/lux/data/collection/sequence.lux34
-rw-r--r--stdlib/source/documentation/lux/data/collection/tree.lux42
-rw-r--r--stdlib/source/documentation/lux/debug.lux38
-rw-r--r--stdlib/source/documentation/lux/documentation.lux48
-rw-r--r--stdlib/source/documentation/lux/ffi.js.lux8
-rw-r--r--stdlib/source/documentation/lux/ffi.jvm.lux18
-rw-r--r--stdlib/source/documentation/lux/ffi.lua.lux8
-rw-r--r--stdlib/source/documentation/lux/ffi.old.lux14
-rw-r--r--stdlib/source/documentation/lux/ffi.py.lux10
-rw-r--r--stdlib/source/documentation/lux/ffi.rb.lux20
-rw-r--r--stdlib/source/documentation/lux/static.lux44
-rw-r--r--stdlib/source/documentation/lux/test.lux42
-rw-r--r--stdlib/source/documentation/lux/type.lux96
-rw-r--r--stdlib/source/documentation/lux/type/abstract.lux86
-rw-r--r--stdlib/source/documentation/lux/type/dynamic.lux42
-rw-r--r--stdlib/source/documentation/lux/type/quotient.lux30
-rw-r--r--stdlib/source/documentation/lux/type/refinement.lux30
22 files changed, 431 insertions, 433 deletions
diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux
index bbefd85a6..823f6efc4 100644
--- a/stdlib/source/documentation/lux.lux
+++ b/stdlib/source/documentation/lux.lux
@@ -172,15 +172,15 @@
(documentation: /.list
"List literals."
- [(: (List Nat)
- (list 0 1 2 3))])
+ [(is (List Nat)
+ (list 0 1 2 3))])
(documentation: /.list&
"List literals, with the last element being a tail-list."
- [(: (List Nat)
- (list& 0 1 2 3
- (: (List Nat)
- (list 4 5 6))))])
+ [(is (List Nat)
+ (list& 0 1 2 3
+ (is (List Nat)
+ (list 4 5 6))))])
(documentation: /.Union
"Union types."
@@ -307,15 +307,15 @@
[(type (All (_ a)
(Maybe (List a))))])
-(documentation: /.:
+(documentation: /.is
"The type-annotation macro."
- [(: (List Int)
- (list +1 +2 +3))])
+ [(is (List Int)
+ (list +1 +2 +3))])
-(documentation: /.:as
+(documentation: /.as
"The type-coercion macro."
- [(:as Dinosaur
- (list +1 +2 +3))])
+ [(as Dinosaur
+ (list +1 +2 +3))])
(documentation: /.Rec
"Parameter-less recursive types."
@@ -350,8 +350,8 @@
(documentation: /.case
(format "The pattern-matching macro."
\n "Allows the usage of macros within the patterns to provide custom syntax.")
- [(case (: (List Int)
- (list +1 +2 +3))
+ [(case (is (List Int)
+ (list +1 +2 +3))
{#Item x {#Item y {#Item z {#End}}}}
{#Some ($_ * x y z)}
@@ -361,8 +361,8 @@
(documentation: /.pattern
(format "Macro-expanding patterns."
\n "It's a special macro meant to be used with 'case'.")
- [(case (: (List Int)
- (list +1 +2 +3))
+ [(case (is (List Int)
+ (list +1 +2 +3))
(pattern (list x y z))
{#Some ($_ * x y z)}
@@ -400,16 +400,16 @@
(documentation: /.function
"Syntax for creating functions."
- [(: (All (_ a b)
- (-> a b a))
- (function (_ x y)
- x))]
+ [(is (All (_ a b)
+ (-> a b a))
+ (function (_ x y)
+ x))]
["Allows for giving the function itself a name, for the sake of recursion."
- (: (-> Nat Nat)
- (function (factorial n)
- (case n
- 0 1
- _ (* n (factorial (-- n))))))])
+ (is (-> Nat Nat)
+ (function (factorial n)
+ (case n
+ 0 1
+ _ (* n (factorial (-- n))))))])
(documentation: /.def:
"Defines global constants/functions."
@@ -464,13 +464,13 @@
(documentation: /.implementation
"Express a value that implements an interface."
- [(: (Order Int)
- (implementation
- (def: &equivalence
- equivalence)
- (def: (< reference subject)
- (< reference subject))
- ))])
+ [(is (Order Int)
+ (implementation
+ (def: &equivalence
+ equivalence)
+ (def: (< reference subject)
+ (< reference subject))
+ ))])
(documentation: /.implementation:
"Interface implementation."
@@ -510,10 +510,10 @@
"Interface definition."
[(type: .public (Order a)
(Interface
- (: (Equivalence a)
- &equivalence)
- (: (-> a a Bit)
- <)))])
+ (is (Equivalence a)
+ &equivalence)
+ (is (-> a a Bit)
+ <)))])
(.template [<name>]
[(documentation: <name>
@@ -765,15 +765,15 @@
"=>"
["documentation/lux" "#doc"]])
-(documentation: /.:parameter
+(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
- (: (Sequence (:parameter 0))
- empty)
+ (is (Sequence (parameter 0))
+ empty)
list))])
(documentation: /.same?
@@ -801,11 +801,11 @@
(^|> value [++ (% 10) (max 1)])
(foo value))])
-(documentation: /.:expected
+(documentation: /.as_expected
"Coerces the given expression to the type of whatever is expected."
- [(: Dinosaur
- (:expected (: (List Nat)
- (list 1 2 3))))])
+ [(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."
@@ -815,13 +815,13 @@
(-> Int Int)
(undefined))])
-(documentation: /.:of
+(documentation: /.type_of
"Generates the type corresponding to a given expression."
[(let [my_num +123]
- (:of my_num))
+ (type_of my_num))
"=="
Int]
- [(:of +123)
+ [(type_of +123)
"=="
Int])
@@ -842,8 +842,8 @@
(documentation: /.char
"If given a 1-character text literal, yields the char-code of the sole character."
- [(: Nat
- (char "A"))
+ [(is Nat
+ (char "A"))
"=>"
65])
@@ -865,13 +865,13 @@
(documentation: /.^code
"Generates pattern-matching code for Code values in a way that looks like code-templating."
- [(: (Maybe Nat)
- (case (` (#0 123 +456.789))
- (^code (#0 (~ [_ {.#Nat number}]) +456.789))
- {.#Some number}
+ [(is (Maybe Nat)
+ (case (` (#0 123 +456.789))
+ (^code (#0 (~ [_ {.#Nat number}]) +456.789))
+ {.#Some number}
- _
- {.#None}))])
+ _
+ {.#None}))])
(documentation: /.false
"The boolean FALSE value.")
@@ -879,24 +879,19 @@
(documentation: /.true
"The boolean TRUE value.")
-(documentation: /.:let
- "Local bindings for types."
- [(:let [side (Either Int Frac)]
- (List [side side]))])
-
(documentation: /.try
""
- [(: Foo
- (case (: (Either Text Bar)
- (try (: Bar
- (risky computation which may panic))))
- {.#Right success}
- (: Foo
- (do something after success))
-
- {.#Left error}
- (: Foo
- (recover from error))))])
+ [(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))))])
(.def: .public documentation
(.List $.Module)
@@ -954,8 +949,8 @@
..template
..not
..type
- ..:
- ..:as
+ ..is
+ ..as
..Rec
..exec
..case
@@ -997,13 +992,13 @@
..static
..^multi
..symbol
- ..:parameter
+ ..parameter
..same?
..^let
..^|>
- ..:expected
+ ..as_expected
..undefined
- ..:of
+ ..type_of
..template:
..as_is
..char
@@ -1012,7 +1007,6 @@
..^code
..false
..true
- ..:let
..try
($.default (/.Code' w))
($.default /.Alias)
diff --git a/stdlib/source/documentation/lux/abstract/codec.lux b/stdlib/source/documentation/lux/abstract/codec.lux
index 567a27e79..d39113c45 100644
--- a/stdlib/source/documentation/lux/abstract/codec.lux
+++ b/stdlib/source/documentation/lux/abstract/codec.lux
@@ -1,20 +1,20 @@
(.using
- [library
- [lux
- ["$" documentation {"+" documentation:}]]]
- [\\library
- ["[0]" /]])
+ [library
+ [lux
+ ["$" documentation {"+" documentation:}]]]
+ [\\library
+ ["[0]" /]])
(documentation: (/.Codec medium value)
"A way to move back-and-forth between a type and an alternative representation for it.")
(documentation: /.composite
"Codec composition."
- [(: (Codec c a)
- (composite (: (Codec c b)
- cb_codec)
- (: (Codec b a)
- ba_codec)))])
+ [(is (Codec c a)
+ (composite (is (Codec c b)
+ cb_codec)
+ (is (Codec b a)
+ ba_codec)))])
(.def: .public documentation
(.List $.Module)
diff --git a/stdlib/source/documentation/lux/control/concatenative.lux b/stdlib/source/documentation/lux/control/concatenative.lux
index bb8be17d8..93dd86efa 100644
--- a/stdlib/source/documentation/lux/control/concatenative.lux
+++ b/stdlib/source/documentation/lux/control/concatenative.lux
@@ -1,20 +1,20 @@
(.using
- [library
- [lux {"-" if loop}
- ["$" documentation {"+" documentation:}]
- [data
- [text
- ["%" format {"+" format}]]]
- [macro
- ["[0]" template]]
- [math
- [number
- ["n" nat]
- ["i" int]
- ["r" rev]
- ["f" frac]]]]]
- [\\library
- ["[0]" /]])
+ [library
+ [lux {"-" if loop}
+ ["$" documentation {"+" documentation:}]
+ [data
+ [text
+ ["%" format {"+" format}]]]
+ [macro
+ ["[0]" template]]
+ [math
+ [number
+ ["n" nat]
+ ["i" int]
+ ["r" rev]
+ ["f" frac]]]]]
+ [\\library
+ ["[0]" /]])
(documentation: /.=>
"Concatenative function types."
@@ -48,8 +48,8 @@
(documentation: /.apply
"A generator for functions that turn arity N functions into arity N concatenative functions."
- [(: (=> [Nat] [Nat])
- ((apply 1) ++))])
+ [(is (=> [Nat] [Nat])
+ ((apply 1) ++))])
(template [<arity>]
[(with_expansions [<name> (template.symbol [/._] ["apply/" <arity>])
diff --git a/stdlib/source/documentation/lux/control/exception.lux b/stdlib/source/documentation/lux/control/exception.lux
index 656b30a5a..96e970156 100644
--- a/stdlib/source/documentation/lux/control/exception.lux
+++ b/stdlib/source/documentation/lux/control/exception.lux
@@ -1,14 +1,14 @@
(.using
- [library
- [lux {"-" if loop}
- ["$" documentation {"+" documentation:}]
- [data
- [text {"+" \n}
- ["%" format {"+" format}]]]
- [macro
- ["[0]" template]]]]
- [\\library
- ["[0]" /]])
+ [library
+ [lux {"-" if loop}
+ ["$" documentation {"+" documentation:}]
+ [data
+ [text {"+" \n}
+ ["%" format {"+" format}]]]
+ [macro
+ ["[0]" template]]]]
+ [\\library
+ ["[0]" /]])
(documentation: (/.Exception it)
"An exception provides a way to decorate error messages.")
@@ -46,11 +46,11 @@
(documentation: /.report
"An error report."
- [(: Text
- (report ["Row 0" value/0]
- ["Row 1" value/1]
- ,,,
- ["Row N" value/N]))])
+ [(is Text
+ (report ["Row 0" value/0]
+ ["Row 1" value/1]
+ ,,,
+ ["Row N" value/N]))])
(documentation: /.listing
(format "A numbered report of the entries on a list."
diff --git a/stdlib/source/documentation/lux/control/security/policy.lux b/stdlib/source/documentation/lux/control/security/policy.lux
index 9bb54bef8..2a373f04c 100644
--- a/stdlib/source/documentation/lux/control/security/policy.lux
+++ b/stdlib/source/documentation/lux/control/security/policy.lux
@@ -39,21 +39,21 @@
(type: (Policy %)
(Interface
- (: (-> Text (Password %))
- password)
- (: (-> (Password %) Text)
- unsafe)))
+ (is (-> Text (Password %))
+ password)
+ (is (-> (Password %) Text)
+ unsafe)))
(def: (policy _)
(Ex (_ %) (-> Any (Policy %)))
(with_policy
- (: (Context Privacy Policy)
- (function (_ (open "%::."))
- (implementation
- (def: (password value)
- (%::can_upgrade value))
- (def: (unsafe password)
- (%::can_downgrade password)))))))]
+ (is (Context Privacy Policy)
+ (function (_ (open "%::."))
+ (implementation
+ (def: (password value)
+ (%::can_upgrade value))
+ (def: (unsafe password)
+ (%::can_downgrade password)))))))]
[(with_policy context)])
(documentation: /.Privacy
diff --git a/stdlib/source/documentation/lux/data/collection/sequence.lux b/stdlib/source/documentation/lux/data/collection/sequence.lux
index 55af9dad9..3d719ee3e 100644
--- a/stdlib/source/documentation/lux/data/collection/sequence.lux
+++ b/stdlib/source/documentation/lux/data/collection/sequence.lux
@@ -1,19 +1,19 @@
(.using
- [library
- [lux {"-" list}
- ["$" documentation {"+" documentation:}]
- [control
- ["<>" parser
- ["<[0]>" code]]]
- [data
- ["[0]" text {"+" \n}
- ["%" format {"+" format}]]]
- [macro
- [syntax {"+" syntax:}]
- ["[0]" code]
- ["[0]" template]]]]
- [\\library
- ["[0]" /]])
+ [library
+ [lux {"-" list}
+ ["$" documentation {"+" documentation:}]
+ [control
+ ["<>" parser
+ ["<[0]>" code]]]
+ [data
+ ["[0]" text {"+" \n}
+ ["%" format {"+" format}]]]
+ [macro
+ [syntax {"+" syntax:}]
+ ["[0]" code]
+ ["[0]" template]]]]
+ [\\library
+ ["[0]" /]])
(documentation: (/.Sequence it)
"A sequential data-structure with fast random access.")
@@ -52,8 +52,8 @@
(documentation: /.sequence
"Sequence literals."
- [(: (Sequence Nat)
- (sequence 12 34 56 78 90))])
+ [(is (Sequence Nat)
+ (sequence 12 34 56 78 90))])
(.def: .public documentation
(.List $.Module)
diff --git a/stdlib/source/documentation/lux/data/collection/tree.lux b/stdlib/source/documentation/lux/data/collection/tree.lux
index 34d05eba3..f4287d194 100644
--- a/stdlib/source/documentation/lux/data/collection/tree.lux
+++ b/stdlib/source/documentation/lux/data/collection/tree.lux
@@ -1,20 +1,20 @@
(.using
- [library
- [lux {"-" list}
- ["$" documentation {"+" documentation:}]
- [control
- ["<>" parser
- ["<[0]>" code]]]
- [data
- ["[0]" text {"+" \n}
- ["%" format {"+" format}]]]
- [macro
- ["[0]" template]]]]
- [\\library
- ["[0]" /]]
- ["[0]" / "_"
- ["[1][0]" finger]
- ["[1][0]" zipper]])
+ [library
+ [lux {"-" list}
+ ["$" documentation {"+" documentation:}]
+ [control
+ ["<>" parser
+ ["<[0]>" code]]]
+ [data
+ ["[0]" text {"+" \n}
+ ["%" format {"+" format}]]]
+ [macro
+ ["[0]" template]]]]
+ [\\library
+ ["[0]" /]]
+ ["[0]" / "_"
+ ["[1][0]" finger]
+ ["[1][0]" zipper]])
(documentation: (/.Tree it)
"A generic tree data-structure.")
@@ -33,11 +33,11 @@
(documentation: /.tree
"Tree literals."
- [(: (Tree Nat)
- (tree 12
- {34 {}
- 56 {}
- 78 {90 {}}}))])
+ [(is (Tree Nat)
+ (tree 12
+ {34 {}
+ 56 {}
+ 78 {90 {}}}))])
(.def: .public documentation
(.List $.Module)
diff --git a/stdlib/source/documentation/lux/debug.lux b/stdlib/source/documentation/lux/debug.lux
index f50793f14..f40a14bde 100644
--- a/stdlib/source/documentation/lux/debug.lux
+++ b/stdlib/source/documentation/lux/debug.lux
@@ -1,14 +1,14 @@
(.using
- [library
- [lux {"-" private}
- ["$" documentation {"+" documentation:}]
- [data
- ["[0]" text {"+" \n}
- ["%" format {"+" format}]]]
- [macro
- ["[0]" template]]]]
- [\\library
- ["[0]" /]])
+ [library
+ [lux {"-" private}
+ ["$" documentation {"+" documentation:}]
+ [data
+ ["[0]" text {"+" \n}
+ ["%" format {"+" format}]]]
+ [macro
+ ["[0]" template]]]]
+ [\\library
+ ["[0]" /]])
(documentation: /.inspection
"A best-effort attempt to generate a textual representation of a value, without knowing its type."
@@ -31,12 +31,12 @@
"Prints/writes a message to standard output."
[(log! message)])
-(documentation: /.:hole
+(documentation: /.hole
(format "A typed 'hole'."
\n "Reveals the type expected of the expression that should go in the hole.")
- [(: (-> Nat Text)
- (function (_ number)
- (:hole)))
+ [(is (-> Nat Text)
+ (function (_ number)
+ (hole)))
"=>"
.Text])
@@ -45,8 +45,8 @@
[(let [foo 123
bar +456
baz +789.0]
- (: Any
- (here)))
+ (is Any
+ (here)))
"=>"
"foo: +123"
"bar: +456"
@@ -57,8 +57,8 @@
(let [foo 123
bar +456
baz +789.0]
- (: Any
- (here [foo %.nat] baz)))
+ (is Any
+ (here [foo %.nat] baz)))
"=>"
"foo: 123"
"baz: +789.0"
@@ -72,7 +72,7 @@
..representation
..private
..log!
- ..:hole
+ ..hole
..here
($.default /.cannot_represent_value)
($.default /.type_hole)
diff --git a/stdlib/source/documentation/lux/documentation.lux b/stdlib/source/documentation/lux/documentation.lux
index 711525027..f1ba6db85 100644
--- a/stdlib/source/documentation/lux/documentation.lux
+++ b/stdlib/source/documentation/lux/documentation.lux
@@ -1,39 +1,39 @@
(.using
- [library
- [lux "*"
- [data
- ["[0]" text {"+" \n}
- ["%" format {"+" format}]]]
- [macro
- ["[0]" template]]]]
- [\\library
- ["[0]" /]])
+ [library
+ [lux "*"
+ [data
+ ["[0]" text {"+" \n}
+ ["%" format {"+" format}]]]
+ [macro
+ ["[0]" template]]]]
+ [\\library
+ ["[0]" /]])
(/.documentation: /.default
""
- [(: /.Definition
- (default ..definition))])
+ [(is /.Definition
+ (default ..definition))])
(/.documentation: /.documentation:
""
[(documentation: /.default
""
- [(: /.Definition
- (default ..definition))])])
+ [(is /.Definition
+ (default ..definition))])])
(/.documentation: /.module
""
- [(: (.List /.Module)
- (module /._
- ""
- [..default
- ..documentation:
- ..module
- (/.default /.unqualified_symbol)
- (/.default /.Definition)
- (/.default /.Module)
- (/.default /.documentation)]
- []))])
+ [(is (.List /.Module)
+ (module /._
+ ""
+ [..default
+ ..documentation:
+ ..module
+ (/.default /.unqualified_symbol)
+ (/.default /.Definition)
+ (/.default /.Module)
+ (/.default /.documentation)]
+ []))])
(.def: .public documentation
(.List /.Module)
diff --git a/stdlib/source/documentation/lux/ffi.js.lux b/stdlib/source/documentation/lux/ffi.js.lux
index 81082ada3..df5a6f037 100644
--- a/stdlib/source/documentation/lux/ffi.js.lux
+++ b/stdlib/source/documentation/lux/ffi.js.lux
@@ -1,6 +1,6 @@
(.using
[library
- [lux {"-" int char type :as}
+ [lux {"-" int char type}
["$" documentation {"+" documentation:}]
[data
["[0]" text {"+" \n}
@@ -46,9 +46,9 @@
(documentation: /.closure
(format "Allows defining closures/anonymous-functions in the form that JavaScript expects."
\n "This is useful for adapting Lux functions for usage by JavaScript code.")
- [(: /.Function
- (closure [left right]
- (do_something (:as Foo left) (:as Bar right))))])
+ [(is /.Function
+ (closure [left right]
+ (do_something (as Foo left) (as Bar right))))])
(.def: .public documentation
(.List $.Module)
diff --git a/stdlib/source/documentation/lux/ffi.jvm.lux b/stdlib/source/documentation/lux/ffi.jvm.lux
index 5bf182890..510636c0f 100644
--- a/stdlib/source/documentation/lux/ffi.jvm.lux
+++ b/stdlib/source/documentation/lux/ffi.jvm.lux
@@ -1,6 +1,6 @@
(.using
[library
- [lux {"-" int char type :as}
+ [lux {"-" int char type as}
["$" documentation {"+" documentation:}]
[data
["[0]" text {"+" \n}
@@ -141,7 +141,7 @@
(documentation: /.???
"Takes a (potentially null) ObjectType reference and creates a (Maybe ObjectType) for it."
- [(= (??? (: java/lang/String (null)))
+ [(= (??? (is java/lang/String (null)))
{.#None})]
[(= (??? "YOLO")
{.#Some "YOLO"})])
@@ -150,7 +150,7 @@
(format "Takes a (Maybe ObjectType) and returns a ObjectType."
\n "A .#None would get translated into a (null).")
[(= (null)
- (!!! (??? (: java/lang/Thread (null)))))]
+ (!!! (??? (is java/lang/Thread (null)))))]
[(= "foo"
(!!! (??? "foo")))])
@@ -245,13 +245,13 @@
(documentation: /.type
""
- [(: Type
- (type java/lang/String))])
+ [(is Type
+ (type java/lang/String))])
-(documentation: /.:as
+(documentation: /.as
""
- [(:as java/lang/Object
- (: java/lang/String
+ [(as java/lang/Object
+ (is java/lang/String
???))])
(.def: .public documentation
@@ -322,7 +322,7 @@
..write!
..class_for
..type
- ..:as
+ ..as
($.default /.Privacy)
($.default /.State)
($.default /.Inheritance)
diff --git a/stdlib/source/documentation/lux/ffi.lua.lux b/stdlib/source/documentation/lux/ffi.lua.lux
index 79d6f03ac..0126a5117 100644
--- a/stdlib/source/documentation/lux/ffi.lua.lux
+++ b/stdlib/source/documentation/lux/ffi.lua.lux
@@ -1,6 +1,6 @@
(.using
[library
- [lux {"-" int char type :as}
+ [lux {"-" int char type}
["$" documentation {"+" documentation:}]
[data
["[0]" text {"+" \n}
@@ -17,9 +17,9 @@
(documentation: /.closure
(format "Allows defining closures/anonymous-functions in the form that Lua expects."
\n "This is useful for adapting Lux functions for usage by Lua code.")
- [(: ..Function
- (closure [left right]
- (do_something (:as Foo left) (:as Bar right))))])
+ [(is ..Function
+ (closure [left right]
+ (do_something (as Foo left) (as Bar right))))])
(.def: .public documentation
(.List $.Module)
diff --git a/stdlib/source/documentation/lux/ffi.old.lux b/stdlib/source/documentation/lux/ffi.old.lux
index 56336a41b..926b70045 100644
--- a/stdlib/source/documentation/lux/ffi.old.lux
+++ b/stdlib/source/documentation/lux/ffi.old.lux
@@ -1,6 +1,6 @@
(.using
[library
- [lux {"-" int char type :as}
+ [lux {"-" int char type}
["$" documentation {"+" documentation:}]
[data
["[0]" text {"+" \n}
@@ -104,7 +104,7 @@
(documentation: /.???
"Takes a (potentially null) ObjectType reference and creates a (Maybe ObjectType) for it."
- [(= (??? (: java/lang/String (null)))
+ [(= (??? (is java/lang/String (null)))
{.#None})]
[(= (??? "YOLO")
{.#Some "YOLO"})])
@@ -115,7 +115,7 @@
(!!! (??? "foo")))]
["A .#None would get translated into a (null)."
(= (null)
- (!!! (??? (: java/lang/Thread (null)))))])
+ (!!! (??? (is java/lang/Thread (null)))))])
(documentation: /.check
(format "Checks whether an object is an instance of a particular class."
@@ -204,13 +204,13 @@
(documentation: /.class_for
"Loads the class as a java.lang.Class object."
- [(: (Primitive "java.lang.Class" ["java.lang.Object"])
- (class_for java/lang/String))])
+ [(is (Primitive "java.lang.Class" ["java.lang.Object"])
+ (class_for java/lang/String))])
(documentation: /.type
""
- [(: .Type
- (type java/lang/String))])
+ [(is .Type
+ (type java/lang/String))])
(.def: .public documentation
(.List $.Module)
diff --git a/stdlib/source/documentation/lux/ffi.py.lux b/stdlib/source/documentation/lux/ffi.py.lux
index 34a88e01d..40ea7878e 100644
--- a/stdlib/source/documentation/lux/ffi.py.lux
+++ b/stdlib/source/documentation/lux/ffi.py.lux
@@ -1,6 +1,6 @@
(.using
[library
- [lux {"-" int char type :as}
+ [lux {"-" int char type}
["$" documentation {"+" documentation:}]
[data
["[0]" text {"+" \n}
@@ -37,10 +37,10 @@
(documentation: /.lambda
(format "Allows defining closures/anonymous-functions in the form that Python expects."
\n "This is useful for adapting Lux functions for usage by Python code.")
- [(: ..Function
- (lambda [left right]
- (do_something (:as Foo left)
- (:as Bar right))))])
+ [(is ..Function
+ (lambda [left right]
+ (do_something (as Foo left)
+ (as Bar right))))])
(.def: .public documentation
(.List $.Module)
diff --git a/stdlib/source/documentation/lux/ffi.rb.lux b/stdlib/source/documentation/lux/ffi.rb.lux
index 01b883a84..822ad8146 100644
--- a/stdlib/source/documentation/lux/ffi.rb.lux
+++ b/stdlib/source/documentation/lux/ffi.rb.lux
@@ -1,14 +1,14 @@
(.using
- [library
- [lux {"-" int char type :as}
- ["$" documentation {"+" documentation:}]
- [data
- ["[0]" text {"+" \n}
- ["%" format {"+" format}]]]
- [macro
- ["[0]" template]]]]
- [\\library
- ["[0]" /]])
+ [library
+ [lux {"-" int char type}
+ ["$" documentation {"+" documentation:}]
+ [data
+ ["[0]" text {"+" \n}
+ ["%" format {"+" format}]]]
+ [macro
+ ["[0]" template]]]]
+ [\\library
+ ["[0]" /]])
(documentation: /.import:
"Easily import types, methods, functions and constants."
diff --git a/stdlib/source/documentation/lux/static.lux b/stdlib/source/documentation/lux/static.lux
index 245ca33bc..bcde2dad6 100644
--- a/stdlib/source/documentation/lux/static.lux
+++ b/stdlib/source/documentation/lux/static.lux
@@ -1,20 +1,20 @@
(.using
- [library
- [lux {"-" nat int rev}
- ["$" documentation {"+" documentation:}]
- [data
- [text
- ["%" format {"+" format}]]
- [collection
- ["[0]" list]]]]]
- [\\library
- ["[0]" /]])
+ [library
+ [lux {"-" nat int rev}
+ ["$" documentation {"+" documentation:}]
+ [data
+ [text
+ ["%" format {"+" format}]]
+ [collection
+ ["[0]" list]]]]]
+ [\\library
+ ["[0]" /]])
(template [<name> <type>]
[(documentation: <name>
(%.code (' (<name>
- (: <type>
- (value generating expression))))))]
+ (is <type>
+ (value generating expression))))))]
[/.nat .Nat]
[/.int .Int]
@@ -26,15 +26,15 @@
(documentation: /.literal
""
[(/.literal
- (: (-> ??? Code)
- format)
- (: ???
- (value generating expression)))])
+ (is (-> ??? Code)
+ format)
+ (is ???
+ (value generating expression)))])
(template [<name> <type>]
[(documentation: <name>
- (%.code (' (: <type>
- (<name>)))))]
+ (%.code (' (is <type>
+ (<name>)))))]
[/.random_nat .Nat]
[/.random_int .Int]
@@ -45,10 +45,10 @@
(documentation: /.random
""
[(/.random
- (: (-> ??? Code)
- format)
- (: (Random ???)
- (random data generator)))])
+ (is (-> ??? Code)
+ format)
+ (is (Random ???)
+ (random data generator)))])
(.def: .public documentation
(.List $.Module)
diff --git a/stdlib/source/documentation/lux/test.lux b/stdlib/source/documentation/lux/test.lux
index 5c4093923..295003e1d 100644
--- a/stdlib/source/documentation/lux/test.lux
+++ b/stdlib/source/documentation/lux/test.lux
@@ -1,17 +1,17 @@
(.using
- [library
- [lux {"-" and for}
- ["$" documentation {"+" documentation:}]
- [control
- ["<>" parser
- ["<[0]>" code]]]
- [data
- ["[0]" text {"+" \n}
- ["%" format {"+" format}]]]
- [macro
- ["[0]" template]]]]
- [\\library
- ["[0]" /]])
+ [library
+ [lux {"-" and for}
+ ["$" documentation {"+" documentation:}]
+ [control
+ ["<>" parser
+ ["<[0]>" code]]]
+ [data
+ ["[0]" text {"+" \n}
+ ["%" format {"+" format}]]]
+ [macro
+ ["[0]" template]]]]
+ [\\library
+ ["[0]" /]])
(documentation: /.Tally
"A record of successes and failures while executing tests.")
@@ -72,29 +72,29 @@
(format "Specifies a test as covering one or more definitions."
\n "Adds to the test tally information to track which definitions have been tested.")
[(cover' [definition/0 definition/1 ,,, definition/N]
- (: Bit
- (some "computation")))])
+ (is Bit
+ (some "computation")))])
(documentation: /.cover
(format "Specifies a test as covering one or more definitions."
\n "Adds to the test tally information to track which definitions have been tested.")
[(cover [definition/0 definition/1 ,,, definition/N]
- (: Bit
- (some "computation")))])
+ (is Bit
+ (some "computation")))])
(documentation: /.for
(format "Specifies a context for tests as covering one or more definitions."
\n "Adds to the test tally information to track which definitions have been tested.")
[(for [definition/0 definition/1 ,,, definition/N]
- (: Test
- some_test))])
+ (is Test
+ some_test))])
(documentation: /.covering
(format "Specifies the module being covered by a test."
\n "Adds tracking information to the tally to know which exported definitions in the module need to be covered.")
[(covering .._
- (: Test
- some_test))])
+ (is Test
+ some_test))])
(documentation: /.in_parallel
"Executes multiple tests in parallel (if the host platform supports it) to take advantage of multiple cores."
diff --git a/stdlib/source/documentation/lux/type.lux b/stdlib/source/documentation/lux/type.lux
index a39d5b2db..957dac26a 100644
--- a/stdlib/source/documentation/lux/type.lux
+++ b/stdlib/source/documentation/lux/type.lux
@@ -1,28 +1,28 @@
(.using
- [library
- [lux {"-" function :as}
- ["$" documentation {"+" documentation:}]
- [control
- ["<>" parser
- ["<[0]>" code]]]
- [data
- ["[0]" text {"+" \n}
- ["%" format]]]
- [macro
- ["[0]" template]]]]
- [\\library
- ["[0]" /]]
- ["[0]" / "_"
- ["[1][0]" abstract]
- ["[1][0]" check]
- ["[1][0]" dynamic]
- ["[1][0]" implicit]
- ["[1][0]" poly]
- ["[1][0]" quotient]
- ["[1][0]" refinement]
- ["[1][0]" resource]
- ["[1][0]" unit]
- ["[1][0]" variance]])
+ [library
+ [lux {"-" function as let}
+ ["$" documentation {"+" documentation:}]
+ [control
+ ["<>" parser
+ ["<[0]>" code]]]
+ [data
+ ["[0]" text {"+" \n}
+ ["%" format]]]
+ [macro
+ ["[0]" template]]]]
+ [\\library
+ ["[0]" /]]
+ ["[0]" / "_"
+ ["[1][0]" abstract]
+ ["[1][0]" check]
+ ["[1][0]" dynamic]
+ ["[1][0]" implicit]
+ ["[1][0]" poly]
+ ["[1][0]" quotient]
+ ["[1][0]" refinement]
+ ["[1][0]" resource]
+ ["[1][0]" unit]
+ ["[1][0]" variance]])
(template [<name>]
[(documentation: <name>
@@ -108,48 +108,53 @@
(documentation: /.array?
"Is a type an array type?")
-(documentation: /.:log!
+(documentation: /.log!
"Logs to the console/terminal the type of an expression."
- [(:log! (: Foo (foo expression)))
+ [(log! (is Foo (foo expression)))
"=>"
"Expression: (foo expression)"
" Type: Foo"
(foo expression)])
-(documentation: /.:as
+(documentation: /.as
(%.format "Casts a value to a specific type."
\n "The specified type can depend on type variables of the original type of the value."
\n "NOTE: Careless use of type-casts is an easy way to introduce bugs. USE WITH CAUTION.")
- [(: (Bar Bit Nat Text)
- (:as [a b c]
+ [(is (Bar Bit Nat Text)
+ (as [a b c]
(Foo a [b c])
(Bar a b c)
- (: (Foo Bit [Nat Text])
- (foo expression))))])
+ (is (Foo Bit [Nat Text])
+ (foo expression))))])
-(documentation: /.:sharing
+(documentation: /.sharing
"Allows specifing the type of an expression as sharing type-variables with the type of another expression."
- [(: (Bar Bit Nat Text)
- (:sharing [a b c]
+ [(is (Bar Bit Nat Text)
+ (sharing [a b c]
(Foo a [b c])
- (: (Foo Bit [Nat Text])
- (foo expression))
+ (is (Foo Bit [Nat Text])
+ (foo expression))
(Bar a b c)
(bar expression)))])
-(documentation: /.:by_example
+(documentation: /.by_example
"Constructs a type that shares type-variables with an expression of some other type."
- [(: Type
- (:by_example [a b c]
+ [(is Type
+ (by_example [a b c]
(Foo a [b c])
- (: (Foo Bit [Nat Text])
- (foo expression))
+ (is (Foo Bit [Nat Text])
+ (foo expression))
(Bar a b c)))
"=>"
(.type (Bar Bit Nat Text))])
+(documentation: /.let
+ "Local bindings for types."
+ [(let [side (Either Int Frac)]
+ (List [side side]))])
+
(.def: .public documentation
(.List $.Module)
($.module /._
@@ -175,10 +180,11 @@
..array
..flat_array
..array?
- ..:log!
- ..:as
- ..:sharing
- ..:by_example
+ ..log!
+ ..as
+ ..sharing
+ ..by_example
+ ..let
($.default /.equivalence)]
[/abstract.documentation
/check.documentation
diff --git a/stdlib/source/documentation/lux/type/abstract.lux b/stdlib/source/documentation/lux/type/abstract.lux
index 62d1ea026..4fdf9e3fc 100644
--- a/stdlib/source/documentation/lux/type/abstract.lux
+++ b/stdlib/source/documentation/lux/type/abstract.lux
@@ -1,17 +1,17 @@
(.using
- [library
- [lux {"-" and}
- ["$" documentation {"+" documentation:}]
- [control
- ["<>" parser
- ["<[0]>" code]]]
- [data
- ["[0]" text {"+" \n}
- ["%" format {"+" format}]]]
- [macro
- ["[0]" template]]]]
- [\\library
- ["[0]" /]])
+ [library
+ [lux {"-" pattern}
+ ["$" documentation {"+" documentation:}]
+ [control
+ ["<>" parser
+ ["<[0]>" code]]]
+ [data
+ ["[0]" text {"+" \n}
+ ["%" format {"+" format}]]]
+ [macro
+ ["[0]" template]]]]
+ [\\library
+ ["[0]" /]])
(documentation: /.Frame
"Meta-data about an abstract/nominal type in a stack of them.")
@@ -23,18 +23,16 @@
"A specific abstract/nominal type still being defined somewhere in the scope."
[(specific name)])
-(template [<name> <from> <to>]
+(template [<name> <from> <$> <to>]
[(documentation: <name>
"Type-casting macro for abstract/nominal types."
[(|> value
- (: Representation)
- :abstraction
- (: Abstraction)
- :representation
- (: Representation))])]
-
- [/.:abstraction representation abstraction]
- [/.:representation abstraction representation]
+ (is <from>)
+ <$>
+ (is <to>))])]
+
+ [/.abstraction Representation abstraction Abstraction]
+ [/.representation Abstraction representation Representation]
)
(documentation: /.abstract:
@@ -45,44 +43,44 @@
(def: (string value)
(-> Text String)
- (:abstraction value))
+ (abstraction value))
(def: (text value)
(-> String Text)
- (:representation value)))]
+ (representation value)))]
["Type-parameters are optional."
(abstract: (Duplicate a)
[a a]
(def: (duplicate value)
(All (_ a) (-> a (Duplicate a)))
- (:abstraction [value value])))]
+ (abstraction [value value])))]
["Definitions can be nested."
(abstract: (Single a)
a
(def: (single value)
(All (_ a) (-> a (Single a)))
- (:abstraction value))
+ (abstraction value))
(abstract: (Double a)
[a a]
(def: (double value)
(All (_ a) (-> a (Double a)))
- (:abstraction [value value]))
+ (abstraction [value value]))
(def: (single' value)
(All (_ a) (-> a (Single a)))
- (:abstraction Single [value value]))
+ (abstraction Single [value value]))
(let [value 0123]
(same? value
(|> value
single'
- (:representation Single)
+ (representation Single)
double
- :representation)))))]
+ 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."
(abstract: (JavaScript a)
@@ -93,17 +91,17 @@
(def: (+ x y)
(-> (JavaScript Expression) (JavaScript Expression) (JavaScript Expression))
- (:abstraction
- (format "(" (:representation x) "+" (:representation y) ")")))
+ (abstraction
+ (format "(" (representation x) "+" (representation y) ")")))
(def: (while test body)
(-> (JavaScript Expression) (JavaScript Statement) (JavaScript Statement))
- (:abstraction
- (format "while(" (:representation test) ") {"
- (:representation body)
+ (abstraction
+ (format "while(" (representation test) ") {"
+ (representation body)
"}"))))])
-(documentation: /.:transmutation
+(documentation: /.transmutation
"Transmutes an abstract/nominal type's phantom types."
[(abstract: (JavaScript a)
Text
@@ -113,17 +111,17 @@
(def: (statement expression)
(-> (JavaScript Expression) (JavaScript Statement))
- (:transmutation expression))
+ (transmutation expression))
(def: (statement' expression)
(-> (JavaScript Expression) (JavaScript Statement))
- (:transmutation JavaScript expression)))])
+ (transmutation JavaScript expression)))])
-(documentation: /.^:representation
+(documentation: /.pattern
"Pattern-matching macro to easily extract a representation."
[(def: (computation abstraction)
(All (_ a) (-> (Abstract a) ???))
- (let [(^:representation value) abstraction]
+ (let [(pattern value) abstraction]
(foo (bar (baz value)))))])
(.def: .public documentation
@@ -133,10 +131,10 @@
[..Frame
..current
..specific
- ..:abstraction
- ..:representation
+ ..abstraction
+ ..representation
..abstract:
- ..:transmutation
- ..^:representation
+ ..transmutation
+ ..pattern
($.default /.no_active_frames)]
[]))
diff --git a/stdlib/source/documentation/lux/type/dynamic.lux b/stdlib/source/documentation/lux/type/dynamic.lux
index 03a8fd322..1140e6158 100644
--- a/stdlib/source/documentation/lux/type/dynamic.lux
+++ b/stdlib/source/documentation/lux/type/dynamic.lux
@@ -1,38 +1,38 @@
(.using
- [library
- [lux {"-" and}
- ["$" documentation {"+" documentation:}]
- [control
- ["<>" parser
- ["<[0]>" code]]]
- [data
- ["[0]" text {"+" \n}
- ["%" format {"+" format}]]]
- [macro
- ["[0]" template]]]]
- [\\library
- ["[0]" /]])
+ [library
+ [lux {"-" static}
+ ["$" documentation {"+" documentation:}]
+ [control
+ ["<>" parser
+ ["<[0]>" code]]]
+ [data
+ ["[0]" text {"+" \n}
+ ["%" format {"+" format}]]]
+ [macro
+ ["[0]" template]]]]
+ [\\library
+ ["[0]" /]])
(documentation: /.Dynamic
"A value coupled with its type, so it can be checked later.")
-(documentation: /.:dynamic
+(documentation: /.dynamic
""
- [(: Dynamic
- (:dynamic 123))])
+ [(is Dynamic
+ (dynamic 123))])
-(documentation: /.:static
+(documentation: /.static
""
- [(: (try.Try Nat)
- (:static Nat (:dynamic 123)))])
+ [(is (try.Try Nat)
+ (static Nat (dynamic 123)))])
(.def: .public documentation
(.List $.Module)
($.module /._
""
[..Dynamic
- ..:dynamic
- ..:static
+ ..dynamic
+ ..static
($.default /.wrong_type)
($.default /.format)]
[]))
diff --git a/stdlib/source/documentation/lux/type/quotient.lux b/stdlib/source/documentation/lux/type/quotient.lux
index 9b6289933..799645f81 100644
--- a/stdlib/source/documentation/lux/type/quotient.lux
+++ b/stdlib/source/documentation/lux/type/quotient.lux
@@ -1,17 +1,17 @@
(.using
- [library
- [lux {"-" type}
- ["$" documentation {"+" documentation:}]
- [control
- ["<>" parser
- ["<[0]>" code]]]
- [data
- ["[0]" text {"+" \n}
- ["%" format {"+" format}]]]
- [macro
- ["[0]" template]]]]
- [\\library
- ["[0]" /]])
+ [library
+ [lux {"-" type}
+ ["$" documentation {"+" documentation:}]
+ [control
+ ["<>" parser
+ ["<[0]>" code]]]
+ [data
+ ["[0]" text {"+" \n}
+ ["%" format {"+" format}]]]
+ [macro
+ ["[0]" template]]]]
+ [\\library
+ ["[0]" /]])
(documentation: (/.Class value label)
"The class knows how to classify/label values that are meant to be equivalent to one another.")
@@ -34,8 +34,8 @@
Type
(type even))
- (: Even
- (quotient even 123))])
+ (is Even
+ (quotient even 123))])
(.def: .public documentation
(.List $.Module)
diff --git a/stdlib/source/documentation/lux/type/refinement.lux b/stdlib/source/documentation/lux/type/refinement.lux
index 008f64e82..bbe26014b 100644
--- a/stdlib/source/documentation/lux/type/refinement.lux
+++ b/stdlib/source/documentation/lux/type/refinement.lux
@@ -1,17 +1,17 @@
(.using
- [library
- [lux {"-" type}
- ["$" documentation {"+" documentation:}]
- [control
- ["<>" parser
- ["<[0]>" code]]]
- [data
- ["[0]" text {"+" \n}
- ["%" format {"+" format}]]]
- [macro
- ["[0]" template]]]]
- [\\library
- ["[0]" /]])
+ [library
+ [lux {"-" type}
+ ["$" documentation {"+" documentation:}]
+ [control
+ ["<>" parser
+ ["<[0]>" code]]]
+ [data
+ ["[0]" text {"+" \n}
+ ["%" format {"+" format}]]]
+ [macro
+ ["[0]" template]]]]
+ [\\library
+ ["[0]" /]])
(documentation: (/.Refined it)
"A refined version of another type, using a predicate to select valid instances.")
@@ -45,8 +45,8 @@
Type
(type even))
- (: (Maybe Even)
- (even 123))])
+ (is (Maybe Even)
+ (even 123))])
(.def: .public documentation
(.List $.Module)