aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux.lux')
-rw-r--r--stdlib/source/library/lux.lux68
1 files changed, 39 insertions, 29 deletions
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index 6f4d8071d..5b7f56b2a 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -1140,7 +1140,7 @@
("lux text concat" "(All [a] (-> a a))" __paragraph)
("lux text concat"
("lux text concat" "## A name can be provided, to specify a recursive type." __paragraph)
- "(All List [a] (| Any [a (List a)]))"))))]
+ "(All List [a] (Variant Any [a (List a)]))"))))]
#End)
(let'' [self_name tokens] ({(#Item [_ (#Identifier "" self_name)] tokens)
[self_name tokens]
@@ -1282,12 +1282,12 @@
(failure "Wrong syntax for list&")}
(list\reverse xs)))
-(macro:' #export (& tokens)
+(macro:' #export (Tuple tokens)
(#Item [(tag$ ["library/lux" "doc"])
(text$ ("lux text concat"
("lux text concat" "## Tuple types:" __paragraph)
("lux text concat"
- ("lux text concat" "(& Text Int Bit)" __paragraph)
+ ("lux text concat" "(Tuple Text Int Bit)" __paragraph)
("lux text concat"
("lux text concat" "## Any." __paragraph)
"(&)"))))]
@@ -1301,15 +1301,15 @@
prevs)))}
(list\reverse tokens)))
-(macro:' #export (| tokens)
+(macro:' #export (Variant tokens)
(#Item [(tag$ ["library/lux" "doc"])
(text$ ("lux text concat"
("lux text concat" "## Variant types:" __paragraph)
("lux text concat"
- ("lux text concat" "(| Text Int Bit)" __paragraph)
+ ("lux text concat" "(Variant Text Int Bit)" __paragraph)
("lux text concat"
("lux text concat" "## Nothing." __paragraph)
- "(|)"))))]
+ "(Variant)"))))]
#End)
({#End
(return (list (identifier$ ["library/lux" "Nothing"])))
@@ -1402,9 +1402,19 @@
(failure "Wrong syntax for def:'''")}
tokens))
+(def:''' #export Or
+ #End
+ Macro
+ ..Variant)
+
+(def:''' #export And
+ #End
+ Macro
+ ..Tuple)
+
(def:''' (pairs xs)
#End
- (All [a] (-> ($' List a) ($' List (& a a))))
+ (All [a] (-> ($' List a) ($' List (Tuple a a))))
({(#Item x (#Item y xs'))
(#Item [x y] (pairs xs'))
@@ -1414,7 +1424,7 @@
(macro:' (let' tokens)
({(#Item [[_ (#Tuple bindings)] (#Item [body #End])])
- (return (list (list\fold ("lux type check" (-> (& Code Code) Code
+ (return (list (list\fold ("lux type check" (-> (Tuple Code Code) Code
Code)
(function' [binding body]
({[label value]
@@ -1535,10 +1545,10 @@
("lux def type tagged" Monad
(#Named ["library/lux" "Monad"]
(All [m]
- (& (All [a] (-> a ($' m a)))
- (All [a b] (-> (-> a ($' m b))
- ($' m a)
- ($' m b))))))
+ (Tuple (All [a] (-> a ($' m a)))
+ (All [a b] (-> (-> a ($' m b))
+ ($' m a)
+ ($' m b))))))
(record$ (list))
["in" "bind"]
#0)
@@ -1577,7 +1587,7 @@
({(#Item monad (#Item [_ (#Tuple bindings)] (#Item body #End)))
(let' [g!in (local_identifier$ "in")
g!bind (local_identifier$ " bind ")
- body' (list\fold ("lux type check" (-> (& Code Code) Code Code)
+ body' (list\fold ("lux type check" (-> (Tuple Code Code) Code Code)
(function' [binding body']
(let' [[var value] binding]
({[_ (#Tag "" "let")]
@@ -1656,7 +1666,7 @@
(def:''' PList
#End
Type
- (All [a] ($' List (& Text a))))
+ (All [a] ($' List (Tuple Text a))))
(def:''' (get k plist)
#End
@@ -1882,7 +1892,7 @@
[_ [_ (#Record fields)]]
(do meta_monad
[=fields (monad\map meta_monad
- ("lux type check" (-> (& Code Code) ($' Meta Code))
+ ("lux type check" (-> (Tuple Code Code) ($' Meta Code))
(function' [kv]
(let' [[k v] kv]
(do meta_monad
@@ -2087,7 +2097,7 @@
[meta (#Form (list\map (apply_template env) elems))]
[meta (#Record members)]
- [meta (#Record (list\map ("lux type check" (-> (& Code Code) (& Code Code))
+ [meta (#Record (list\map ("lux type check" (-> (Tuple Code Code) (Tuple Code Code))
(function' [kv]
(let' [[slot value] kv]
[(apply_template env slot) (apply_template env value)])))
@@ -2296,7 +2306,7 @@
(def:''' (macro' modules current_module module name)
#End
- (-> ($' List (& Text Module))
+ (-> ($' List (Tuple Text Module))
Text Text Text
($' Maybe Macro))
(do maybe_monad
@@ -2462,7 +2472,7 @@
(form$ (#Item [(tag$ tag) (list\map walk_type parts)]))
[_ (#Tuple members)]
- (` (& (~+ (list\map walk_type members))))
+ (` (Tuple (~+ (list\map walk_type members))))
[_ (#Form (#Item [_ (#Text "lux in-module")]
(#Item [_ (#Text module)]
@@ -2536,7 +2546,7 @@
(template [<name> <type> <value>]
[(def:''' (<name> xy)
#End
- (All [a b] (-> (& a b) <type>))
+ (All [a b] (-> (Tuple a b) <type>))
(let' [[x y] xy] <value>))]
[first a x]
@@ -2544,7 +2554,7 @@
(def:''' (unfold_type_def type_codes)
#End
- (-> ($' List Code) ($' Meta (& Code ($' Maybe ($' List Text)))))
+ (-> ($' List Code) ($' Meta (Tuple Code ($' Maybe ($' List Text)))))
({(#Item [_ (#Record pairs)] #End)
(do meta_monad
[members (monad\map meta_monad
@@ -2557,7 +2567,7 @@
(failure "Wrong syntax for variant case.")}
pair)))
pairs)]
- (return [(` (& (~+ (list\map second members))))
+ (return [(` (Tuple (~+ (list\map second members))))
(#Some (list\map first members))]))
(#Item type #End)
@@ -2565,7 +2575,7 @@
(return [(` .Any) (#Some (list member_name))])
[_ (#Form (#Item [_ (#Tag "" member_name)] member_types))]
- (return [(` (& (~+ member_types))) (#Some (list member_name))])
+ (return [(` (Tuple (~+ member_types))) (#Some (list member_name))])
_
(return [type #None])}
@@ -2583,13 +2593,13 @@
(return [member_name member_type])
[_ (#Form (#Item [_ (#Tag "" member_name)] member_types))]
- (return [member_name (` (& (~+ member_types)))])
+ (return [member_name (` (Tuple (~+ member_types)))])
_
(failure "Wrong syntax for variant case.")}
case)))
(list& case cases))]
- (return [(` (| (~+ (list\map second members))))
+ (return [(` (..Variant (~+ (list\map second members))))
(#Some (list\map first members))]))
_
@@ -4208,7 +4218,7 @@
($_ text\compose "(" name " " (|> params (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")"))
(#Sum _)
- ($_ text\compose "(| " (|> (flat_variant type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")")
+ ($_ text\compose "(Or " (|> (flat_variant type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")")
(#Product _)
($_ text\compose "[" (|> (flat_tuple type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) "]")
@@ -4950,7 +4960,7 @@
(-> Location Location)
[file line (inc column)])
-(def: rejoin_all_pairs
+(def: un_paired
(-> (List [Code Code]) (List Code))
(|>> (list\map rejoin_pair) list\join))
@@ -4983,9 +4993,9 @@
<open>
parts_text
<close>)])])
- ([#Form "(" ")" ..function\identity]
- [#Tuple "[" "]" ..function\identity]
- [#Record "{" "}" rejoin_all_pairs])
+ ([#Form "(" ")" |>]
+ [#Tuple "[" "]" |>]
+ [#Record "{" "}" ..un_paired])
[new_location (#Rev value)]
("lux io error" "@doc_example_to_text Undefined behavior.")