aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux.lux')
-rw-r--r--stdlib/source/lux.lux21
1 files changed, 16 insertions, 5 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux
index 1bb7efa07..b2deead45 100644
--- a/stdlib/source/lux.lux
+++ b/stdlib/source/lux.lux
@@ -1559,7 +1559,7 @@
({(#Left msg)
(#Left msg)
- (#Right state' a)
+ (#Right [state' a])
(f a state')}
(ma state))))})
@@ -2205,7 +2205,7 @@
1 "1" 2 "2" 3 "3"
4 "4" 5 "5" 6 "6"
7 "7" 8 "8" 9 "9"
- _ ("lux io error" "undefined")}
+ _ ("lux io error" "@digit::format Undefined behavior.")}
digit))
(def:''' (nat\encode value)
@@ -2700,7 +2700,7 @@
(int\encode value)
[_ (#Rev value)]
- ("lux io error" "Undefined behavior.")
+ ("lux io error" "@code\encode Undefined behavior.")
[_ (#Frac value)]
(frac\encode value)
@@ -4943,7 +4943,7 @@
[#Record "{" "}" rejoin_all_pairs])
[new_location (#Rev value)]
- ("lux io error" "Undefined behavior.")
+ ("lux io error" "@doc_example->Text Undefined behavior.")
))
(def: (with_baseline baseline [file line column])
@@ -5510,6 +5510,12 @@
_
(fail (..wrong_syntax_error (name_of ..:assume)))))
+(def: location
+ {#.doc "The location of the current expression being analyzed."}
+ (Meta Location)
+ (function (_ compiler)
+ (#Right [compiler (get@ #location compiler)])))
+
(macro: #export (undefined tokens)
{#.doc (doc "Meant to be used as a stand-in for functions with undefined implementations."
"Undefined expressions will type-check against everything, so they make good dummy implementations."
@@ -5519,7 +5525,12 @@
(undefined)))}
(case tokens
#Nil
- (return (list (` (..error! "Undefined behavior."))))
+ (do meta_monad
+ [location ..location
+ #let [[module line column] location
+ location ($_ "lux text concat" (text\encode module) "," (nat\encode line) "," (nat\encode column))
+ message ($_ "lux text concat" "Undefined behavior @ " location)]]
+ (wrap (list (` (..error! (~ (text$ message)))))))
_
(fail (..wrong_syntax_error (name_of ..undefined)))))