aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/control/exception.lux15
-rw-r--r--stdlib/source/lux/tool/compiler/phase/analysis/function.lux4
2 files changed, 14 insertions, 5 deletions
diff --git a/stdlib/source/lux/control/exception.lux b/stdlib/source/lux/control/exception.lux
index 5d241b0c6..cc8635b13 100644
--- a/stdlib/source/lux/control/exception.lux
+++ b/stdlib/source/lux/control/exception.lux
@@ -109,18 +109,27 @@
(~ (maybe.default (' "") body))))})))))
)))
+(def: header-separator ": ")
+
(def: #export (report' entries)
(-> (List [Text Text]) Text)
(let [largest-header-size (|> entries
(list@map (|>> product.left text.size))
- (list@fold n/max 0))]
+ (list@fold n/max 0))
+ on-new-line (|> " "
+ (list.repeat (n/+ (text.size header-separator)
+ largest-header-size))
+ (text.join-with "")
+ (text@compose text.new-line))]
(|> entries
(list@map (function (_ [header message])
(let [padding (|> " "
(list.repeat (n/- (text.size header)
largest-header-size))
(text.join-with ""))]
- ($_ text@compose padding header ": " message))))
+ (|> message
+ (text.replace-all text.new-line on-new-line)
+ ($_ text@compose padding header ..header-separator)))))
(text.join-with text.new-line))))
(syntax: #export (report {entries (p.many (s.tuple (p.and s.any s.any)))})
@@ -131,7 +140,7 @@
(def: separator
($_ "lux text concat"
text.new-line text.new-line
- "----------------------------------------------------------------"
+ (|> "-" (list.repeat 64) (text.join-with ""))
text.new-line text.new-line))
(def: #export (decorate prelude error)
diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/function.lux b/stdlib/source/lux/tool/compiler/phase/analysis/function.lux
index fbaaf2fc5..76effa0dc 100644
--- a/stdlib/source/lux/tool/compiler/phase/analysis/function.lux
+++ b/stdlib/source/lux/tool/compiler/phase/analysis/function.lux
@@ -34,8 +34,8 @@
["Arguments" (|> arguments
list.enumerate
(list@map (.function (_ [idx argC])
- (format text.new-line " " (%n idx) " " (%code argC))))
- (text.join-with ""))]))
+ (format (%n idx) " " (%code argC))))
+ (text.join-with text.new-line))]))
(def: #export (function analyse function-name arg-name body)
(-> Phase Text Text Code (Operation Analysis))