aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux.lux
diff options
context:
space:
mode:
authorEduardo Julian2021-07-26 01:45:57 -0400
committerEduardo Julian2021-07-26 01:45:57 -0400
commite64b6d0114c26a455e19a416b5f02a4d19dd711f (patch)
tree020e426a40aefebf6b052e799b33c40fe4d8a80c /stdlib/source/library/lux.lux
parent62b3abfcc014ca1c19d62aacdd497f6a250b372c (diff)
Re-named Promise to Async.
Diffstat (limited to 'stdlib/source/library/lux.lux')
-rw-r--r--stdlib/source/library/lux.lux306
1 files changed, 153 insertions, 153 deletions
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index eb2676ee3..4ed6dd7aa 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -749,7 +749,7 @@
(record$ #Nil)
#0)
-("lux def" fail
+("lux def" failure
("lux type check"
(#UnivQ #Nil
(#Function Text
@@ -771,7 +771,7 @@
#Nil))
_
- (fail "Wrong syntax for let''")}
+ (failure "Wrong syntax for let''")}
tokens)))
(record$ #.Nil)
#0)
@@ -808,7 +808,7 @@
#Nil))
_
- (fail "Wrong syntax for function''")}
+ (failure "Wrong syntax for function''")}
tokens)))
(record$ #.Nil)
#0)
@@ -916,7 +916,7 @@
#Nil]))
_
- (fail "Wrong syntax for def''")}
+ (failure "Wrong syntax for def''")}
tokens)))
(record$ #.Nil)
#0)
@@ -949,7 +949,7 @@
#Nil))
_
- (fail "Wrong syntax for macro:'")}
+ (failure "Wrong syntax for macro:'")}
tokens)))
(record$ #.Nil)
#0)
@@ -976,7 +976,7 @@
#Nil))
_
- (fail "Wrong syntax for $'")}
+ (failure "Wrong syntax for $'")}
tokens))
(def:'' (list\map f xs)
@@ -1102,7 +1102,7 @@
(quantified_args_parser args' (function'' [names] (next (#Cons arg_name names))))
_
- (fail "Expected identifier.")}
+ (failure "Expected identifier.")}
args))
(def:'' (make_parameter idx)
@@ -1173,7 +1173,7 @@
#Nil)))))
_
- (fail "Wrong syntax for All")}
+ (failure "Wrong syntax for All")}
tokens)))
(macro:' #export (Ex tokens)
@@ -1217,7 +1217,7 @@
#Nil)))))
_
- (fail "Wrong syntax for Ex")}
+ (failure "Wrong syntax for Ex")}
tokens)))
(def:'' (list\reverse list)
@@ -1244,7 +1244,7 @@
#Nil))
_
- (fail "Wrong syntax for ->")}
+ (failure "Wrong syntax for ->")}
(list\reverse tokens)))
(macro:' #export (list xs)
@@ -1277,7 +1277,7 @@
init)))
_
- (fail "Wrong syntax for list&")}
+ (failure "Wrong syntax for list&")}
(list\reverse xs)))
(macro:' #export (& tokens)
@@ -1327,7 +1327,7 @@
tokens)
({(#Cons [[_ (#Tuple args)] (#Cons [body #Nil])])
({#Nil
- (fail "function' requires a non-empty arguments tuple.")
+ (failure "function' requires a non-empty arguments tuple.")
(#Cons [harg targs])
(return (list (form$ (list (tuple$ (list (local_identifier$ name)
@@ -1341,7 +1341,7 @@
args)
_
- (fail "Wrong syntax for function'")}
+ (failure "Wrong syntax for function'")}
tokens')))
(macro:' (def:''' tokens)
@@ -1397,7 +1397,7 @@
(bit$ #0)))))
_
- (fail "Wrong syntax for def:'''")}
+ (failure "Wrong syntax for def:'''")}
tokens))
(def:''' (as_pairs xs)
@@ -1422,7 +1422,7 @@
(list\reverse (as_pairs bindings)))))
_
- (fail "Wrong syntax for let'")}
+ (failure "Wrong syntax for let'")}
tokens))
(def:''' (any? p xs)
@@ -1496,11 +1496,11 @@
(return (list (list\fold (function/flip (_$_joiner op)) first nexts)))
_
- (fail "Wrong syntax for _$")}
+ (failure "Wrong syntax for _$")}
tokens')
_
- (fail "Wrong syntax for _$")}
+ (failure "Wrong syntax for _$")}
tokens))
(macro:' #export ($_ tokens)
@@ -1518,11 +1518,11 @@
(return (list (list\fold (_$_joiner op) last prevs)))
_
- (fail "Wrong syntax for $_")}
+ (failure "Wrong syntax for $_")}
(list\reverse tokens'))
_
- (fail "Wrong syntax for $_")}
+ (failure "Wrong syntax for $_")}
tokens))
## (interface: (Monad m)
@@ -1593,7 +1593,7 @@
monad)))))
_
- (fail "Wrong syntax for do")}
+ (failure "Wrong syntax for do")}
tokens))
(def:''' (monad\map m f xs)
@@ -1648,7 +1648,7 @@
test))))
_
- (fail "Wrong syntax for if")}
+ (failure "Wrong syntax for if")}
tokens))
(def:''' (get k plist)
@@ -1899,7 +1899,7 @@
(return (list (form$ (list (tag$ ["library/lux" "Primitive"]) (text$ class_name) (untemplate_list params)))))
_
- (fail "Wrong syntax for primitive")}
+ (failure "Wrong syntax for primitive")}
tokens))
(def:'' (current_module_name state)
@@ -1932,7 +1932,7 @@
=template)))))
_
- (fail "Wrong syntax for `")}
+ (failure "Wrong syntax for `")}
tokens))
(macro:' #export (`' tokens)
@@ -1946,7 +1946,7 @@
(wrap (list (form$ (list (text$ "lux type check") (identifier$ ["library/lux" "Code"]) =template)))))
_
- (fail "Wrong syntax for `")}
+ (failure "Wrong syntax for `")}
tokens))
(macro:' #export (' tokens)
@@ -1960,7 +1960,7 @@
(wrap (list (form$ (list (text$ "lux type check") (identifier$ ["library/lux" "Code"]) =template)))))
_
- (fail "Wrong syntax for '")}
+ (failure "Wrong syntax for '")}
tokens))
(macro:' #export (|> tokens)
@@ -1986,7 +1986,7 @@
apps)))
_
- (fail "Wrong syntax for |>")}
+ (failure "Wrong syntax for |>")}
tokens))
(macro:' #export (<| tokens)
@@ -2012,7 +2012,7 @@
apps)))
_
- (fail "Wrong syntax for <|")}
+ (failure "Wrong syntax for <|")}
(list\reverse tokens)))
(def:''' (compose f g)
@@ -2156,15 +2156,15 @@
(list\map (compose apply (make_env bindings')))
list\join
return)
- (fail "Irregular arguments tuples for template.")))
+ (failure "Irregular arguments tuples for template.")))
_
- (fail "Wrong syntax for template")}
+ (failure "Wrong syntax for template")}
[(monad\map maybe_monad get_short bindings)
(monad\map maybe_monad tuple_to_list data)])
_
- (fail "Wrong syntax for template")}
+ (failure "Wrong syntax for template")}
tokens))
(def:''' (n// param subject)
@@ -2439,7 +2439,7 @@
(return [key val''])
_
- (fail "The value-part of a KV-pair in a record must macro-expand to a single Code.")}
+ (failure "The value-part of a KV-pair in a record must macro-expand to a single Code.")}
val'))))
pairs)]
(wrap (list (record$ pairs'))))
@@ -2488,11 +2488,11 @@
(wrap (list (walk_type type')))
_
- (fail "The expansion of the type-syntax had to yield a single element.")}
+ (failure "The expansion of the type-syntax had to yield a single element.")}
type+))
_
- (fail "Wrong syntax for type")}
+ (failure "Wrong syntax for type")}
tokens))
(macro:' #export (: tokens)
@@ -2504,7 +2504,7 @@
(return (list (` ("lux type check" (type (~ type)) (~ value)))))
_
- (fail "Wrong syntax for :")}
+ (failure "Wrong syntax for :")}
tokens))
(macro:' #export (:as tokens)
@@ -2516,7 +2516,7 @@
(return (list (` ("lux type as" (type (~ type)) (~ value)))))
_
- (fail "Wrong syntax for :as")}
+ (failure "Wrong syntax for :as")}
tokens))
(def:''' (empty? xs)
@@ -2547,7 +2547,7 @@
(return [member_name member_type])
_
- (fail "Wrong syntax for variant case.")}
+ (failure "Wrong syntax for variant case.")}
pair)))
pairs)]
(return [(` (& (~+ (list\map second members))))
@@ -2579,14 +2579,14 @@
(return [member_name (` (& (~+ member_types)))])
_
- (fail "Wrong syntax for variant case.")}
+ (failure "Wrong syntax for variant case.")}
case)))
(list& case cases))]
(return [(` (| (~+ (list\map second members))))
(#Some (list\map first members))]))
_
- (fail "Improper type-definition syntax")}
+ (failure "Improper type-definition syntax")}
type_codes))
(def:''' (gensym prefix state)
@@ -2617,7 +2617,7 @@
(return (list (` (#.Apply .Nothing (#.UnivQ #.Nil (~ body')))))))
_
- (fail "Wrong syntax for Rec")}
+ (failure "Wrong syntax for Rec")}
tokens))
(macro:' #export (exec tokens)
@@ -2638,7 +2638,7 @@
actions))))
_
- (fail "Wrong syntax for exec")}
+ (failure "Wrong syntax for exec")}
(list\reverse tokens)))
(macro:' (def:' tokens)
@@ -2684,7 +2684,7 @@
(~ (bit$ export?)))))))
#None
- (fail "Wrong syntax for def'")}
+ (failure "Wrong syntax for def'")}
parts)))
(def:' (rejoin_pair pair)
@@ -2775,11 +2775,11 @@
(do meta_monad [] (wrap (list)))
_
- (fail ($_ text\compose "'lux.case' expects an even number of tokens: " (|> branches
- (list\map code\encode)
- (interpose " ")
- list\reverse
- (list\fold text\compose ""))))}
+ (failure ($_ text\compose "'lux.case' expects an even number of tokens: " (|> branches
+ (list\map code\encode)
+ (interpose " ")
+ list\reverse
+ (list\fold text\compose ""))))}
branches))
(macro:' #export (case tokens)
@@ -2798,7 +2798,7 @@
(wrap (list (` ((~ (record$ (as_pairs expansion))) (~ value))))))
_
- (fail "Wrong syntax for case")}
+ (failure "Wrong syntax for case")}
tokens))
(macro:' #export (^ tokens)
@@ -2821,10 +2821,10 @@
(wrap (list& pattern' body branches))
_
- (fail "^ can only expand to 1 pattern.")))
+ (failure "^ can only expand to 1 pattern.")))
_
- (fail "Wrong syntax for ^ macro")))
+ (failure "Wrong syntax for ^ macro")))
(macro:' #export (^or tokens)
(list [(tag$ ["library/lux" "doc"])
@@ -2845,7 +2845,7 @@
(^ (list& [_ (#Form patterns)] body branches))
(case patterns
#Nil
- (fail "^or cannot have 0 patterns")
+ (failure "^or cannot have 0 patterns")
_
(let' [pairs (|> patterns
@@ -2853,7 +2853,7 @@
(list\join))]
(return (list\compose pairs branches))))
_
- (fail "Wrong syntax for ^or")))
+ (failure "Wrong syntax for ^or")))
(def:' (identifier? code)
(-> Code Bit)
@@ -2885,10 +2885,10 @@
body)
list
return)
- (fail "let requires an even number of parts"))
+ (failure "let requires an even number of parts"))
_
- (fail "Wrong syntax for let")))
+ (failure "Wrong syntax for let")))
(macro:' #export (function tokens)
(list [(tag$ ["library/lux" "doc"])
@@ -2920,7 +2920,7 @@
(list\fold (nest g!blank) body (list\reverse tail))))))
#None
- (fail "Wrong syntax for function")))
+ (failure "Wrong syntax for function")))
(def:' (process_def_meta_value code)
(-> Code Code)
@@ -3069,7 +3069,7 @@
(~ (bit$ exported?)))))))
#None
- (fail "Wrong syntax for def:"))))
+ (failure "Wrong syntax for def:"))))
(def: (meta_code_add addition meta)
(-> [Code Code] Code Code)
@@ -3101,7 +3101,7 @@
" ([#Identifier] [#Tag])"
__paragraph
" _" ..\n
- " (fail ''Wrong syntax for name_of'')))"))])
+ " (failure ''Wrong syntax for name_of'')))"))])
(let [[exported? tokens] (export^ tokens)
name+args+meta+body?? (: (Maybe [Name (List Code) (List [Code Code]) Code])
(case tokens
@@ -3137,7 +3137,7 @@
(~ (bit$ exported?)))))))
#None
- (fail "Wrong syntax for macro:"))))
+ (failure "Wrong syntax for macro:"))))
(macro: #export (interface: tokens)
{#.doc (text$ ($_ "lux text concat"
@@ -3184,7 +3184,7 @@
(wrap [name type])
_
- (fail "Signatures require typed members!"))))
+ (failure "Signatures require typed members!"))))
(list\join sigs')))
#let [[_module _name] name+
def_name (identifier$ name)
@@ -3203,7 +3203,7 @@
(return (list (` (..type: (~+ (export exported?)) (~ usage) (~ sig_meta) (~ sig_type))))))
#None
- (fail "Wrong syntax for interface:"))))
+ (failure "Wrong syntax for interface:"))))
(def: (find f xs)
(All [a b]
@@ -3231,7 +3231,7 @@
init)))
_
- (fail <message>)))]
+ (failure <message>)))]
[and (if (~ pre) (~ post) #0) "'and' requires >=1 clauses." "Short-circuiting 'and': (and #1 #0 #1) ## => #0"]
[or (if (~ pre) #1 (~ post)) "'or' requires >=1 clauses." "Short-circuiting 'or': (or #1 #0 #1) ## => #1"])
@@ -3444,7 +3444,7 @@
(return output)
_
- (fail (text\compose "Unknown tag: " (name\encode [module name]))))))
+ (failure (text\compose "Unknown tag: " (name\encode [module name]))))))
(def: (resolve_type_tags type)
(-> Type (Meta (Maybe [(List Name) (List Type)])))
@@ -3503,7 +3503,7 @@
(return tags)
_
- (fail "No tags available for type.")))
+ (failure "No tags available for type.")))
#let [tag_mappings (: (List [Text Code])
(list\map (function (_ tag) [(second tag) (tag$ tag)])
tags))]
@@ -3517,10 +3517,10 @@
(wrap [tag value])
_
- (fail (text\compose "Unknown implementation member: " tag_name)))
+ (failure (text\compose "Unknown implementation member: " tag_name)))
_
- (fail "Invalid implementation member."))))
+ (failure "Invalid implementation member."))))
(list\join tokens'))]
(wrap (list (record$ members)))))
@@ -3583,7 +3583,7 @@
(implementation (~+ definitions)))))))
#None
- (fail "Wrong syntax for implementation:"))))
+ (failure "Wrong syntax for implementation:"))))
(def: (function\identity x) (All [a] (-> a a)) x)
@@ -3669,10 +3669,10 @@
(~ (bit$ exported?))))))))
#None
- (fail "Wrong syntax for type:"))))
+ (failure "Wrong syntax for type:"))))
#None
- (fail "Wrong syntax for type:"))
+ (failure "Wrong syntax for type:"))
))
(template [<name> <to>]
@@ -3715,7 +3715,7 @@
(return name)
_
- (fail "#only/#+ and #exclude/#- require identifiers."))))
+ (failure "#only/#+ and #exclude/#- require identifiers."))))
defs))
(def: (referrals_parser tokens)
@@ -3759,7 +3759,7 @@
(return struct_name)
_
- (fail "Expected all implementations of opening form to be identifiers.")))
+ (failure "Expected all implementations of opening form to be identifiers.")))
structs)
next+remainder (openings_parser parts')]
(let [[next remainder] next+remainder]
@@ -3809,24 +3809,24 @@
(def: parallel_hierarchy_sigil
"\")
-(def: (normalize_parallel_path' hierarchy root)
+(def: (normal_parallel_path' hierarchy root)
(-> Text Text Text)
(case [(text\split_with ..module_separator hierarchy)
(text\split_with ..parallel_hierarchy_sigil root)]
[(#.Some [_ hierarchy'])
(#.Some ["" root'])]
- (normalize_parallel_path' hierarchy' root')
+ (normal_parallel_path' hierarchy' root')
_
(case root
"" hierarchy
_ ($_ text\compose root ..module_separator hierarchy))))
-(def: (normalize_parallel_path hierarchy root)
+(def: (normal_parallel_path hierarchy root)
(-> Text Text (Maybe Text))
(case (text\split_with ..parallel_hierarchy_sigil root)
(#.Some ["" root'])
- (#.Some (normalize_parallel_path' hierarchy root'))
+ (#.Some (normal_parallel_path' hierarchy root'))
_
#.None))
@@ -3883,10 +3883,10 @@
0 prefix
_ ($_ text\compose prefix ..module_separator clean))]
(return output))
- (fail ($_ "lux text concat"
- "Cannot climb the module hierarchy..." ..\n
- "Importing module: " module ..\n
- " Relative Root: " relative_root ..\n))))))
+ (failure ($_ "lux text concat"
+ "Cannot climb the module hierarchy..." ..\n
+ "Importing module: " module ..\n
+ " Relative Root: " relative_root ..\n))))))
(def: (alter_domain alteration domain import)
(-> Nat Text Importation Importation)
@@ -3922,7 +3922,7 @@
## Nested
(^ [_ (#Tuple (list& [_ (#Identifier ["" m_name])] extra))])
(do meta_monad
- [import_name (case (normalize_parallel_path relative_root m_name)
+ [import_name (case (normal_parallel_path relative_root m_name)
(#.Some parallel_path)
(wrap parallel_path)
@@ -3946,7 +3946,7 @@
(^ [_ (#Tuple (list& [_ (#Text alias)] [_ (#Identifier ["" m_name])] extra))])
(do meta_monad
- [import_name (case (normalize_parallel_path relative_root m_name)
+ [import_name (case (normal_parallel_path relative_root m_name)
(#.Some parallel_path)
(wrap parallel_path)
@@ -3973,9 +3973,9 @@
_
(do meta_monad
[current_module current_module_name]
- (fail ($_ text\compose
- "Wrong syntax for import @ " current_module
- ..\n (code\encode token)))))))
+ (failure ($_ text\compose
+ "Wrong syntax for import @ " current_module
+ ..\n (code\encode token)))))))
imports)]
(wrap (list\join imports'))))
@@ -4171,13 +4171,13 @@
temp))
)))
-(def: (zip/2 xs ys)
+(def: (zipped/2 xs ys)
(All [a b] (-> (List a) (List b) (List [a b])))
(case xs
(#Cons x xs')
(case ys
(#Cons y ys')
- (list& [x y] (zip/2 xs' ys'))
+ (list& [x y] (zipped/2 xs' ys'))
_
(list))
@@ -4250,7 +4250,7 @@
struct_evidence (resolve_type_tags init_type)]
(case struct_evidence
#None
- (fail (text\compose "Can only 'open' structs: " (type\encode init_type)))
+ (failure (text\compose "Can only 'open' structs: " (type\encode init_type)))
(#Some tags&members)
(do meta_monad
@@ -4274,13 +4274,13 @@
#None
(wrap enhanced_target))))
target
- (zip/2 locals members))]
+ (zipped/2 locals members))]
(wrap (` ({(~ pattern) (~ enhanced_target)} (~ (identifier$ source)))))))))
name tags&members body)]
(wrap (list full_body)))))
_
- (fail "Wrong syntax for ^open")))
+ (failure "Wrong syntax for ^open")))
(macro: #export (cond tokens)
{#.doc (text$ ($_ "lux text concat"
@@ -4291,7 +4291,7 @@
" ## else_branch" ..\n
" ''???'')"))}
(if ("lux i64 =" 0 (n/% 2 (list\size tokens)))
- (fail "cond requires an uneven number of arguments.")
+ (failure "cond requires an uneven number of arguments.")
(case (list\reverse tokens)
(^ (list& else branches'))
(return (list (list\fold (: (-> [Code Code] Code Code)
@@ -4302,7 +4302,7 @@
(as_pairs branches'))))
_
- (fail "Wrong syntax for cond"))))
+ (failure "Wrong syntax for cond"))))
(def: (enumeration' idx xs)
(All [a] (-> Nat (List a) (List [Nat a])))
@@ -4344,11 +4344,11 @@
(if ("lux i64 =" idx r_idx)
g!output
g!_)]))
- (zip/2 tags (enumeration members))))]
+ (zipped/2 tags (enumeration members))))]
(return (list (` ({(~ pattern) (~ g!output)} (~ record))))))
_
- (fail "get@ can only use records.")))
+ (failure "get@ can only use records.")))
(^ (list [_ (#Tuple slots)] record))
(return (list (list\fold (: (-> Code Code Code)
@@ -4364,7 +4364,7 @@
(wrap (list (` (function ((~ g!_) (~ g!record)) (..get@ (~ selector) (~ g!record)))))))
_
- (fail "Wrong syntax for get@")))
+ (failure "Wrong syntax for get@")))
(def: (open_field alias tags my_tag_index [module short] source type)
(-> Text (List Name) Nat Name Code Type (Meta (List Code)))
@@ -4387,7 +4387,7 @@
(: (-> [Nat Name Type] (Meta (List Code)))
(function (_ [sub_tag_index sname stype])
(open_field alias tags' sub_tag_index sname source+ stype)))
- (enumeration (zip/2 tags' members')))]
+ (enumeration (zipped/2 tags' members')))]
(return (list\join decls')))
_
@@ -4422,11 +4422,11 @@
[decls' (monad\map meta_monad (: (-> [Nat Name Type] (Meta (List Code)))
(function (_ [tag_index sname stype])
(open_field alias tags tag_index sname source stype)))
- (enumeration (zip/2 tags members)))]
+ (enumeration (zipped/2 tags members)))]
(return (list\join decls')))
_
- (fail (text\compose "Can only 'open:' structs: " (type\encode struct_type)))))
+ (failure (text\compose "Can only 'open:' structs: " (type\encode struct_type)))))
_
(do meta_monad
@@ -4437,7 +4437,7 @@
(` (..open: (~ (text$ alias)) (~ g!struct)))))))
_
- (fail "Wrong syntax for open:")))
+ (failure "Wrong syntax for open:")))
(macro: #export (|>> tokens)
{#.doc (text$ ($_ "lux text concat"
@@ -4482,11 +4482,11 @@
#refer_open openings})
_
- (fail ($_ text\compose "Wrong syntax for refer @ " current_module
- ..\n (|> options
- (list\map code\encode)
- (interpose " ")
- (list\fold text\compose "")))))))
+ (failure ($_ text\compose "Wrong syntax for refer @ " current_module
+ ..\n (|> options
+ (list\map code\encode)
+ (interpose " ")
+ (list\fold text\compose "")))))))
(def: (write_refer module_name [r_defs r_opens])
(-> Text Refer (Meta (List Code)))
@@ -4499,7 +4499,7 @@
(function (_ _def)
(if (is_member? all_defs _def)
(return [])
- (fail ($_ text\compose _def " is not defined in module " module_name " @ " current_module)))))
+ (failure ($_ text\compose _def " is not defined in module " module_name " @ " current_module)))))
referred_defs)))]
defs' (case r_defs
#All
@@ -4544,7 +4544,7 @@
(write_refer module_name =refer))
_
- (fail "Wrong syntax for refer")))
+ (failure "Wrong syntax for refer")))
(def: (refer_to_code module_name module_alias' [r_defs r_opens])
(-> Text (Maybe Text) Refer Code)
@@ -4630,7 +4630,7 @@
(return (list (` ((..\ (~ struct) (~ member)) (~+ args)))))
_
- (fail "Wrong syntax for \")))
+ (failure "Wrong syntax for \")))
(macro: #export (set@ tokens)
{#.doc (text$ ($_ "lux text concat"
@@ -4658,7 +4658,7 @@
(do meta_monad
[g!slot (gensym "")]
(return [r_slot_name r_idx g!slot]))))
- (zip/2 tags (enumeration members)))]
+ (zipped/2 tags (enumeration members)))]
(let [pattern (record$ (list\map (: (-> [Name Nat Code] [Code Code])
(function (_ [r_slot_name r_idx r_var])
[(tag$ r_slot_name)
@@ -4674,12 +4674,12 @@
(return (list (` ({(~ pattern) (~ output)} (~ record)))))))
_
- (fail "set@ can only use records.")))
+ (failure "set@ can only use records.")))
(^ (list [_ (#Tuple slots)] value record))
(case slots
#Nil
- (fail "Wrong syntax for set@")
+ (failure "Wrong syntax for set@")
_
(do meta_monad
@@ -4687,7 +4687,7 @@
(: (-> Code (Meta Code))
(function (_ _) (gensym "temp")))
slots)
- #let [pairs (zip/2 slots bindings)
+ #let [pairs (zipped/2 slots bindings)
update_expr (list\fold (: (-> [Code Code] Code Code)
(function (_ [s b] v)
(` (..set@ (~ s) (~ v) (~ b)))))
@@ -4719,7 +4719,7 @@
(..set@ (~ selector) (~ g!value) (~ g!record)))))))
_
- (fail "Wrong syntax for set@")))
+ (failure "Wrong syntax for set@")))
(macro: #export (update@ tokens)
{#.doc (text$ ($_ "lux text concat"
@@ -4747,7 +4747,7 @@
(do meta_monad
[g!slot (gensym "")]
(return [r_slot_name r_idx g!slot]))))
- (zip/2 tags (enumeration members)))]
+ (zipped/2 tags (enumeration members)))]
(let [pattern (record$ (list\map (: (-> [Name Nat Code] [Code Code])
(function (_ [r_slot_name r_idx r_var])
[(tag$ r_slot_name)
@@ -4763,12 +4763,12 @@
(return (list (` ({(~ pattern) (~ output)} (~ record)))))))
_
- (fail "update@ can only use records.")))
+ (failure "update@ can only use records.")))
(^ (list [_ (#Tuple slots)] fun record))
(case slots
#Nil
- (fail "Wrong syntax for update@")
+ (failure "Wrong syntax for update@")
_
(do meta_monad
@@ -4794,7 +4794,7 @@
(..update@ (~ selector) (~ g!fun) (~ g!record)))))))
_
- (fail "Wrong syntax for update@")))
+ (failure "Wrong syntax for update@")))
(macro: #export (^template tokens)
{#.doc (text$ ($_ "lux text concat"
@@ -4854,10 +4854,10 @@
(return (list\compose output branches))
#None
- (fail "Wrong syntax for ^template"))
+ (failure "Wrong syntax for ^template"))
_
- (fail "Wrong syntax for ^template")))
+ (failure "Wrong syntax for ^template")))
(def: (find_baseline_column code)
(-> Code Nat)
@@ -5097,7 +5097,7 @@
[inits' (: (Meta (List Name))
(case (monad\map maybe_monad get_name inits)
(#Some inits') (return inits')
- #None (fail "Wrong syntax for loop")))
+ #None (failure "Wrong syntax for loop")))
init_types (monad\map meta_monad find_type inits')
expected get_expected_type]
(return (list (` (("lux type check"
@@ -5117,7 +5117,7 @@
(~ body)))))))))
#.None
- (fail "Wrong syntax for loop"))))
+ (failure "Wrong syntax for loop"))))
(macro: #export (^slots tokens)
{#.doc (doc "Allows you to extract record members as local variables with the same names."
@@ -5137,7 +5137,7 @@
(return slots)
#None
- (fail "Wrong syntax for ^slots")))
+ (failure "Wrong syntax for ^slots")))
#let [[hslot tslots] slots]
hslot (normalize hslot)
tslots (monad\map meta_monad normalize tslots)
@@ -5158,7 +5158,7 @@
(return (list& pattern body branches)))
_
- (fail "Wrong syntax for ^slots")))
+ (failure "Wrong syntax for ^slots")))
(def: (place_tokens label tokens target)
(-> Text (List Code) Code (Maybe (List Code)))
@@ -5231,16 +5231,16 @@
(wrap output)
_
- (fail "[with_expansions] Improper macro expansion.")))
+ (failure "[with_expansions] Improper macro expansion.")))
#Nil
(return bodies)
_
- (fail "Wrong syntax for with_expansions"))
+ (failure "Wrong syntax for with_expansions"))
_
- (fail "Wrong syntax for with_expansions")))
+ (failure "Wrong syntax for with_expansions")))
(def: (flat_alias type)
(-> Type Type)
@@ -5278,7 +5278,7 @@
["Text" Text text$])
_
- (fail (text\compose "Cannot anti-quote type: " (name\encode name))))))
+ (failure (text\compose "Cannot anti-quote type: " (name\encode name))))))
(def: (anti_quote token)
(-> Code (Meta Code))
@@ -5323,7 +5323,7 @@
(wrap (list pattern')))
_
- (fail "Wrong syntax for 'static'.")))
+ (failure "Wrong syntax for 'static'.")))
(type: Multi_Level_Case
[Code (List [Code Code])])
@@ -5342,7 +5342,7 @@
(-> (List Code) (Meta Multi_Level_Case))
(case levels
#Nil
- (fail "Multi-level patterns cannot be empty.")
+ (failure "Multi-level patterns cannot be empty.")
(#Cons init extras)
(do meta_monad
@@ -5419,7 +5419,7 @@
(wrap output)))
_
- (fail "Wrong syntax for ^multi")))
+ (failure "Wrong syntax for ^multi")))
## TODO: Allow asking the compiler for the name of the definition
## currently being defined. That name can then be fed into
@@ -5441,7 +5441,7 @@
([#Identifier] [#Tag])
_
- (fail (..wrong_syntax_error ["library/lux" "name_of"]))))
+ (failure (..wrong_syntax_error ["library/lux" "name_of"]))))
(def: (get_scope_type_vars state)
(Meta (List Nat))
@@ -5471,10 +5471,10 @@
(wrap (list (` (#Ex (~ (nat$ var_id))))))
#None
- (fail (text\compose "Indexed-type does not exist: " (nat\encode idx)))))
+ (failure (text\compose "Indexed-type does not exist: " (nat\encode idx)))))
_
- (fail (..wrong_syntax_error (name_of ..$)))))
+ (failure (..wrong_syntax_error (name_of ..$)))))
(def: #export (is? reference sample)
{#.doc (doc "Tests whether the 2 values are identical (not just 'equal')."
@@ -5501,7 +5501,7 @@
branches)))
_
- (fail (..wrong_syntax_error (name_of ..^@)))))
+ (failure (..wrong_syntax_error (name_of ..^@)))))
(macro: #export (^|> tokens)
{#.doc (doc "Pipes the value being pattern-matched against prior to binding it to a variable."
@@ -5517,7 +5517,7 @@
branches)))
_
- (fail (..wrong_syntax_error (name_of ..^|>)))))
+ (failure (..wrong_syntax_error (name_of ..^|>)))))
(macro: #export (:assume tokens)
{#.doc (doc "Coerces the given expression to the type of whatever is expected."
@@ -5529,7 +5529,7 @@
(wrap (list (` ("lux type as" (~ (type_to_code type)) (~ expr))))))
_
- (fail (..wrong_syntax_error (name_of ..:assume)))))
+ (failure (..wrong_syntax_error (name_of ..:assume)))))
(def: location
{#.doc "The location of the current expression being analyzed."}
@@ -5554,7 +5554,7 @@
(wrap (list (` (..error! (~ (text$ message)))))))
_
- (fail (..wrong_syntax_error (name_of ..undefined)))))
+ (failure (..wrong_syntax_error (name_of ..undefined)))))
(macro: #export (:of tokens)
{#.doc (doc "Generates the type corresponding to a given expression."
@@ -5581,7 +5581,7 @@
(..:of (~ g!temp)))))))
_
- (fail (..wrong_syntax_error (name_of ..:of)))))
+ (failure (..wrong_syntax_error (name_of ..:of)))))
(def: (complex_declaration_parser tokens)
(-> (List Code) (Meta [[Text (List Text)] (List Code)]))
@@ -5595,12 +5595,12 @@
(wrap arg_name)
_
- (fail "Could not parse an argument.")))
+ (failure "Could not parse an argument.")))
args')]
(wrap [[name args] tokens']))
_
- (fail "Could not parse a complex declaration.")
+ (failure "Could not parse a complex declaration.")
))
(def: (any_parser tokens)
@@ -5610,7 +5610,7 @@
(return [token tokens'])
_
- (fail "Could not parse anything.")
+ (failure "Could not parse anything.")
))
(def: (many_parser tokens)
@@ -5620,7 +5620,7 @@
(return [tokens (list)])
_
- (fail "Could not parse anything.")
+ (failure "Could not parse anything.")
))
(def: (end_parser tokens)
@@ -5630,7 +5630,7 @@
(return [])
_
- (fail "Expected input Codes to be empty.")
+ (failure "Expected input Codes to be empty.")
))
(def: (anns_parser tokens)
@@ -5715,14 +5715,14 @@
(wrap (:as ..Text value))
_
- (fail ($_ text\compose
- "Invalid target platform (must be a value of type Text): " (name\encode identifier)
- " : " (..code\encode (..type_to_code type))))))
+ (failure ($_ text\compose
+ "Invalid target platform (must be a value of type Text): " (name\encode identifier)
+ " : " (..code\encode (..type_to_code type))))))
_
- (fail ($_ text\compose
- "Invalid target platform syntax: " (..code\encode choice)
- ..\n "Must be either a text literal or an identifier."))))
+ (failure ($_ text\compose
+ "Invalid target platform syntax: " (..code\encode choice)
+ ..\n "Must be either a text literal or an identifier."))))
(def: (target_pick target options default)
(-> Text (List [Code Code]) (Maybe Code) (Meta (List Code)))
@@ -5730,7 +5730,7 @@
#Nil
(case default
#.None
- (fail ($_ text\compose "No code for target platform: " target))
+ (failure ($_ text\compose "No code for target platform: " target))
(#.Some default)
(return (list default)))
@@ -5753,7 +5753,7 @@
(target_pick target options (#.Some default))
_
- (fail (..wrong_syntax_error (name_of ..for))))))
+ (failure (..wrong_syntax_error (name_of ..for))))))
(template [<name> <type> <output>]
[(def: (<name> xy)
@@ -5809,7 +5809,7 @@
(~ labelled))))))
_
- (fail (..wrong_syntax_error (name_of ..``)))
+ (failure (..wrong_syntax_error (name_of ..``)))
))
(def: (name$ [module name])
@@ -5879,7 +5879,7 @@
(return unquoted)
[_ (#Form (#Cons [[_ (#Identifier ["" "~+"])] (#Cons [spliced #Nil])]))]
- (fail "Cannot use (~+) inside of ^code unless it is the last element in a form or a tuple.")
+ (failure "Cannot use (~+) inside of ^code unless it is the last element in a form or a tuple.")
(^template [<tag> <untemplate>]
[[_ (<tag> elems)]
@@ -5904,7 +5904,7 @@
(wrap (list pattern)))
_
- (fail (..wrong_syntax_error (name_of ..^code)))))
+ (failure (..wrong_syntax_error (name_of ..^code)))))
(def: #export false
Bit
@@ -5924,10 +5924,10 @@
(list localT (` (..as_is (~ valueT))))))
(list\fold list\compose (list))))]
(~ bodyT)))))
- (..fail ":let requires an even number of parts"))
+ (..failure ":let requires an even number of parts"))
_
- (..fail (..wrong_syntax_error (name_of ..:let)))))
+ (..failure (..wrong_syntax_error (name_of ..:let)))))
(macro: #export (try tokens)
{#.doc (doc (case (try (risky_computation input))
@@ -5945,4 +5945,4 @@
(~ expression)))))))
_
- (..fail (..wrong_syntax_error (name_of ..try)))))
+ (..failure (..wrong_syntax_error (name_of ..try)))))